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

Improve version_menu_pagelinks feature to avoid 404s #1151

Open
chalin opened this issue Aug 9, 2022 · 1 comment
Open

Improve version_menu_pagelinks feature to avoid 404s #1151

chalin opened this issue Aug 9, 2022 · 1 comment

Comments

@chalin
Copy link
Collaborator

chalin commented Aug 9, 2022

For context, see:

Linking to pages that exist between versions is the easy part. Avoiding 404s is essential for most projects I work with.

@fekete-robert
Copy link
Collaborator

To be honest, I can't think of a way to detect 404s with Hugo, because the different versions of the docs are often separate Hugo sites, so often its not possible to check the existence of the link within the site, because they are just external links. That leads to using some tool or script external to Hugo that scrapes the built html files and checks whether the canonical links point to a valid url (here again, define valid: must it be status 200, or do you accept 301 as well, how do you handle password-protected sites, and so on).

So I'd say that validating these links is outside the scope of Hugo/Docsy. One improvement I can think of would be to add an optional parameter to the frontmatter of the page to override the canonical url manually. That way, if you have two versions of a page (say, v1/oldpage and v2/newpage), you can add the something like this to the v1/oldpage frontmatter:

override-canonical-url: "v2/newpage" 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants