I have specified relative links in my _pkgdown.yml, for example:
navbar:
components:
get-started:
text: Get started
href: articles/Using-this-package.html
Where necessary 'pkgdown' seems to cleverly adapt these links by adding a ../ prefix, so that links do not become .../articles/articles/....
But this doesn't seem to be the case on the '404' page: https://me.github.io/my-package/articles/Nothing-here.html gives the helpful 404 message "use the links in the navbar", but these links contain an extra articles so do not themselves work.
One possible solution might be to use the entry in the url: yaml field to write the links on the 404 page?
Can you provide a link to the config file and live site?
At least in this example, you are overriding the default behaviour of pkgdown, which automatically generates a "Get Started" navbar link if you have a vignette with the same name as the package.
Config fle: https://github.com/ms609/TreeDist/blob/master/inst/_pkgdown.yml
Site: https://ms609.github.io/TreeDist/
Yes, I've overridden the default behaviour in order to control the order that the vignettes/articles are listed.
The root of the problem is that the 404 page can appear at any level of the site at "run time", so really all links need to be converted to absolute. That's probably straightforward to hack in via xml munging. (Or possibly by providing a <base> tag)?
I am wondering how making navbar link absolutes would work with previews of the website (locally, on Netlify). Could the 404 redirect to something? (a 404 at the root)
oh wait the absolute links would only be on the 404 :woman_facepalming:
Yeah, and since you can't get the 404 locally, it should all work.