zeon-studio / hugoplate

Hugoplate is a free starter template built with Hugo and TailwindCSS that will save you hours of work.
https://zeon.studio/preview?project=hugoplate
MIT License
798 stars 218 forks source link

wrong translation links with language switcher in header and footer #103

Closed jillesvangurp closed 6 months ago

jillesvangurp commented 6 months ago

What is your Hugo Extended Version

v0.123.8-5fed9c591b694f314e5939548e11cc3dcb79a79c+extended

What is your Go Version

go1.22.1

What is your Node.js Version

v18.18.0

Check for Existing Issues

Expected Behavior

The links for translations in the header and footer are the same

Steps to Reproduce

I added the language switcher component to my header and footer.

Our front page is available in EN and DE.

The header switcher lists correct links. The footer does not and instead seems to show links for different pages on our website.

Code Reproduction URL

No response

Additional Information

Also see discussion here: https://discourse.gohugo.io/t/language-switcher-used-twice-generating-different/48712/5

Our website repository is private so I can't provide a link to that. A preview of our website is available here: https://newwww.tryformation.com

tfsomrat commented 6 months ago

Hey @jillesvangurp, use this language switcher https://github.com/zeon-studio/hugoplate/blob/main/layouts/partials/components/language-switcher.html

jillesvangurp commented 6 months ago

I have, mine is adapted from that. Both have the same issue.

tfsomrat commented 6 months ago

hey @jillesvangurp, you said that the header switcher works correctly. and we don't give support if anything goes wrong after your customization. we use github issues only for the theme issues, if you need to customize the theme, you can hire us from here https://zeon.studio/estimate-project

saikadaramakaisosjupita commented 6 months ago

Re-open and read this thread https://discourse.gohugo.io/t/language-switcher-used-twice-generating-different/48712/19 cc @tfsomrat

jillesvangurp commented 6 months ago

@yaardie that's the exact thread that I started and linked above.

Not using partialCached like hugoplate does in a lot of places, was the solution here.

tfsomrat commented 5 months ago

Most probably partialCached is creating the issue, try to remove Cached when you are calling any functional things in it.

jillesvangurp commented 5 months ago

That indeed fixed things for me. To quote Joe (from Hugo)

Can someone please log an issue against hugoplate advising them about what a bad idea this is?

saikadaramakaisosjupita commented 5 months ago

Most probably partialCached is creating the issue, try to remove Cached when you are calling any functional things in it.

The issue here is you are following bad coding standards. You should not cache the footer.