Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: problem multilingual solved #1585

Open
1 task done
taf-neutrino opened this issue Aug 29, 2024 · 0 comments
Open
1 task done

[Enhancement]: problem multilingual solved #1585

taf-neutrino opened this issue Aug 29, 2024 · 0 comments
Labels
enhancement New feature or improvement

Comments

@taf-neutrino
Copy link

taf-neutrino commented Aug 29, 2024

What you'd like to propose?

Hugo version: v0.133.0
PaperMod release: 7.0

[solved] First problem, multilingual breadcrumbs.

Example path of file sistem: /content/articles

Configuration hugo.yaml

...
languages:
    en:  
        permalinks:
        page:
            articles: /articles/:slug/
        section:
            articles: /articles/
        menu:
            main:
                - name: Articles
                url: articles/
    it:
        permalinks:
        page:
            articles: /articoli/:slug/
        section:
            articles: /articoli/
        menu:
            main:
                - name: Articoli
                url: articoli/
...

The problem is found in breadcrumbs, if you use only one language works correctly.
I modified the file /layouts/partials/breadcrumbs.html with the code I attach.

{{- if (.Param "ShowBreadCrumbs") -}}
<div class="breadcrumbs">
    {{- range .Ancestors.Reverse }}
    <a href="{{ .RelPermalink }}">{{ if .IsHome }}{{ i18n "home" }}{{ else }}{{ print "&nbsp;»&nbsp;" | safeHTML }}{{ .Title }}{{ end }}</a>    
    {{- end -}}
</div>
{{- end -}}

[solved] Second problem, translation tag page.

Configuration hugo.yaml

...
languages:
    en:
        taxonomies:
        tag: tags
    it:
        taxonomies:
        tag: etichette
...

For tags page the problem is present for other languages, the data are not shown.

The solution:

# i18n/en.yaml
- id: tag
  translation: "tags"

# i18n/it.yaml  
- id: tag
  translation: "etichette"

I've changed row number 46 /layouts/_default/single.html

    <!-- original code -->
    {{- $tags := .Language.Params.Taxonomies.tag | default "tags" }}
    <!-- code modified -->
    {{- $tags := .Language.Params.Taxonomies.tag | default | i18n "tag" }}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@taf-neutrino taf-neutrino added the enhancement New feature or improvement label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

No branches or pull requests

1 participant