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]: Display Tags for Multilingual Posts #1632

Open
1 task done
cozyan opened this issue Nov 17, 2024 · 0 comments
Open
1 task done

[Enhancement]: Display Tags for Multilingual Posts #1632

cozyan opened this issue Nov 17, 2024 · 0 comments
Labels
enhancement New feature or improvement

Comments

@cozyan
Copy link

cozyan commented Nov 17, 2024

What you'd like to propose?

In the current demo, when navigating to related posts, the following tags are displayed:

image

However, when you switch to /fr and then click a post, for example on this page, no tags are listed:

image

The reason is that in themes/PaperMod/layouts/_default/single.html, we only allow .Language.Params.Taxonomies.tag as defined in config.yml. I think it would be better to allow dynamic tags for different language pages.

For example, in my current setup, I switched to the following code:

<footer class="post-footer">
    {{- if eq .Lang "en" }}
        {{- if .Params.tags }}
        <ul class="post-tags">
            {{- range (.GetTerms "tags") }}
            <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
            {{- end }}
        </ul>
        {{- end }}
    {{- else if eq .Lang "cn" }}
        {{- with .Params.cntags }}
        <ul class="post-tags">
            {{- range . }}
            <li><a href="/cn/cntags/{{ . | urlize }}">{{ . }}</a></li>
            {{- end }}
        </ul>
        {{- end }}
    {{- end }}
    {{- if (.Param "ShowPostNavLinks") }}
    {{- partial "post_nav_links.html" . }}
    {{- end }}
    {{- if (and site.Params.ShowShareButtons (ne .Params.disableShare true)) }}
    {{- partial "share_icons.html" . -}}
    {{- end }}
</footer>

This code allows me to display tags under both English posts and Chinese posts.

Expected Behavior

Tags should appear under the post for the selected language.

Actual Behavior

Tags are not displayed for posts in non-default languages.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@cozyan cozyan added the enhancement New feature or improvement label Nov 17, 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