-
Notifications
You must be signed in to change notification settings - Fork 907
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
Github View/Edit links broken if defaultContentLanguageInSubdir = false #1420
Comments
I have a similar setup for another project, and there are no issues with the GH page links. I'll investigate further and get back to you soon (probably later today). |
I haven't double checked yet, but off the top of my head what I recall is that you'll need to replace the From https://gohugo.io/hugo-modules/configuration/#module-config-mounts (emphasis mine):
Let me know if this helps. |
We don't use module mounts for this project, so it's not mixed. I've played around them a bit but didn't seem to solve the issue. I'll override the partial locally in our project to fix the links for now. |
It would be great if @chalin's workaround works because this is an old, old problem - as you discovered, you can't actually find defaultContentLanguageInSubdir via params in the partial, so there have been a variety of hacky solutions from various Docsy users, including overriding the entire partial. |
@LisaFC I couldn't get it work, but I have found another one that might be good enough to create an "official" workaround. You can access the
If this is set in the config file, then something like this works in the partial (I don't manage multilanguage sites so I don't know what the proper conditions would be):
What do you think? |
Nice site you have there!
If you're using Docsy, since Docsy uses mounts, then your project is using mounts too 🤷♂️: Lines 24 to 46 in 5597d43
Ok. I'll take a look as soon as I can (quite busy atm). I'm starting to feel that this is a bug in the page-link rendering. In the meantime, you should be able to use the path_base_for_github_subdir feature (with |
FYI, I just checked my other projects, and they all have their docs under |
I was able to use the workaround provided by @chalin. Sample toml config: [params.path_base_for_github_subdir]
# change content/<lang>/... to content/...
from = "content/(.*?)/(.*?)"
to = "content/$2" |
@fekete-robert - can you confirm whether the following would have fixed the issue? |
Yes, it seems to work. Thanks! |
Hi, I am working on a site that uses Docsy 0.6.0 and might have hit a bug related to the following settings:
The site is only available in English, so we don't use the content/en/ subdir. The site builds fine, but the github links "View/edit this page" are broken, because they do contain the "/en/" part.
I wanted to create a PR to omit the language from https://github.com/google/docsy/blob/main/layouts/partials/page-meta-links.html if "defaultContentLanguageInSubdir = false", but since this parameter is not under the [params] tag of the config file, it's not accessible from the partial (unless I'm missing something).
Does anyone have a solution or workaround to the problem? It's not a big issue, if there is no neat solution I'll just hide the links. An ugly workaround would be to duplicate the "defaultContentLanguageInSubdir = false" under [params] as well, but that's a really ugly hack.
The site is https://kube-logging.github.io/docs/ , its source is available at https://github.com/kube-logging/kube-logging.github.io/blob/master/config/_default/config.toml
Thanks!
Robert
The text was updated successfully, but these errors were encountered: