-
Hi, my website contains multiple products' documents in sub-folders, and some of them have localized versions (e.g. Chinese), some don't.
Any suggestions? Related discussions:
The following Hugo methods are just for reference and collecting ideas:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Hi. I'm experimenting with (and hence cannot fully yet endorse this approach) the use of This approach comes at a cost: it effectively duplicates pages, which is a problem for SEO ... unless we set the canonical link properly. I'm working on fixing the canonical link, you can track progress via open-telemetry/opentelemetry.io#4487. I'll see if I can port a variant of that solution to Docsy (#1537) when I've vetted it enough.
Here's how I set it up for the OTel website: module:
mounts:
- source: content/en
target: content
- source: content/zh
target: content
lang: zh
- excludeFiles: specs/*
source: content/en/docs # zh missing-page fallback
target: content/docs
lang: zh This is excerpt from https://github.com/open-telemetry/opentelemetry.io/blob/269c3b343926615bfc78a237562a4d28d1a528d3/hugo.yaml#L212-L222. You can see this live at, for example: https://opentelemetry.io/zh/docs/. |
Beta Was this translation helpful? Give feedback.
-
layouts/partials/link-element-rel-canonical.html
This partial has some caveats (see comments in header), but it seems to work OK on both Linux and Windows. You can take it for a spin by cloning this again: git clone --single-branch -b hugo-forum-topic-37225 https://github.com/jmooring/hugo-testing hugo-forum-topic-37225
cd hugo-forum-topic-37225
hugo server With the Hugo methods currently available, this seems a bit fragile, but I'll let you be the judge. |
Beta Was this translation helpful? Give feedback.
-
Regardless of approach, |
Beta Was this translation helpful? Give feedback.
-
Just to add one note here. |
Beta Was this translation helpful? Give feedback.
Hi. I'm experimenting with (and hence cannot fully yet endorse this approach) the use of
mount
points to specify fallback pages. This is effectively the mount solution proposed by @jmooring in Do all page bundles need localized copies once you add a new language?, that you pointed out.This approach comes at a cost: it effectively duplicates pages, which is a problem for SEO ... unless we set the canonical link properly. I'm working on fixing the canonical link, you can track progress via open-telemetry/opentelemetry.io#4487. I'll see if I can port a variant of that solution to Docsy (#1537) when I've vetted it enough.