Open lucmartinon opened 1 month ago
It is weird because in my template site it is working. Even though I use jekyll serve
to do local tests, when I upload to GitHub pages I use jekyll build
, as can be seen in this workflow. I use the static_href
tag to do the language switcher, which is done here and you can see it working on the demo page. One thing that I do before calling jekyll build
is export JEKYLL_ENV=production
. Maybe this changes something for your case? Idk.
I tried locally to set JEKYLL_ENV=production and it didn't solve the problem.
To be honest, I am not sure that the problem comes from jekyll serve vs jekyll build. This is what was suggested in #158, and since I am using jekyll serve I thought so, but I am not sure. It could also be that the problem comes from running Jekyll in a docker rather than directly on my machine, although I don't see why that should change anything.
Do you have any idea on how to investigate further? I'm happy to spend time on it, but I don't know where to start
If you run both jekyll serve
and jekyll build
inside a docker but only one of them works, then the problem is not with docker.
One test to be done: try to remove the if
from inside the static_href
, rather do it outside.
If this doesn't work I would suggest you changing how you create the localized pages and see if this changes anything. For example, in my template I have different directories for each language and use the page_id
front matter variable to identify the same page from different languages.
I was not able to run jekyll serve
, something was failing and I was not able to see the results, so I am not sure the problem comes from there.
I removed the if
but still not working.
However I found a dirty workaround that I will use for now: since the problem is only with the links to the default language on the non-default-language page, I can add a fake language as a default language, skip this language in the loop to display my languages.
That means putting a redirect on in all my pages in case someone accesses the page without language, but that works, and that way I detect the browser language too, which is better than using the default language anyway.
Hello,
I commented on #158 2 weeks ago, but got no answer so opening a new one!
I would like to reopen this issue: I also have a project where I don't use jekyll serve, only jekyll build, since I have anyway an nginx server running to serve a data api. I seems to me that this is causing the static_href tag to not function.
I added a detailled example on a personal website that is in construction:
code here: https://gitlab.com/lucmartinon/cnrs_pfas_web/-/blob/main/frontend/pages/about.fr.md?ref_type=heads
which is published here http://vps-8ea64a15.vps.ovh.net/fr/about/
the link to /about is changed to /fr/about although it is in a static_href tag.
Beside this, fantastic plugin! thanks a lot!