Docusaurus v2 doesn't allow for "mypagename.html" links
See original GitHub issueWe migrated and now have a series of issues being raised because none of our 7 year old links ending in .html
resolve correctly.
This is the main issue tracking this: https://github.com/facebook/watchman/issues/798
A couple of kind souls have submitted PRs to change links elsewhere: https://github.com/facebook/watchman/pull/806 https://github.com/facebook/watchman/pull/801
but this is really a docusaurus issue. How can we get this fixed?
Issue Analytics
- State:
- Created 3 years ago
- Comments:30 (7 by maintainers)
Top Results From Across the Web
docusaurus.config.js
Allow to customize the presence/absence of a trailing slash at the end of URLs/links, and how static HTML files are generated:.
Read more >Markdown links - Docusaurus
Markdown links. There are two ways of adding a link to another page: through a URL path and a file path. - [URL...
Read more >Routing - Docusaurus
Docusaurus ' routing system follows single-page application conventions: one route, one component.
Read more >Manual migration | Docusaurus
This manual migration process should be run after the automated migration process, to complete the missing parts, or debug issues in the ...
Read more >Versioning - Docusaurus
In this case, the current version and latest version will both be point to v1, since the v2 docs doesn't even exist yet!...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @wez , sorry for the delay.
Just wanted to let you know that the fixes you need are already merged on master and will be released soon in 2.0.0-alpha.57
What you will need to do on Watchman:
add a slug to each doc
With the extension you want, which will be used for the main/canonical/SEO url
Use the client redirects plugin
Plugin doc
Your configuration should look like:
And if there exist a
/docs/nodejs.html
page, then going to/docs/nodejs
will redirect to/docs/nodejs.html
Hi all,
Here are a few comments, proposals and questions I have
Valid urls of Watchman
I understand that such url should work:
Does it mean that BOTH urls should work?
I don’t know how Watchman site worked before, is it still online somewhere to check?
Hosting on Github pages
Watchman is hosted on Github pages. As far as I know, it’s not possible to do any server-side redirect on this hosting solution.
Also, for Github pages to serve a non-404 answer, the file actually has to exist on the FS with the html extension.
On other platforms like netlify, it would have been posssible to drop a simple _redirects file and handle this.
It might be a good idea to start using a custom domain, which would allow more flexibility to change the underlying hosting solution without too much pain.
Using .html extension in document id
If Watchman just need the
/nodejs.html
, and not the/nodejs
page, it’s possible to use .html as suffix in document idsUsing a file like
filename.html.md
also worksduplicating the pages
Creating 2 html pages for the same document could be a portable solution
The duplicate pages would have a canonical url to the main page so that SEO can know which page is the main one.
Is it worth redirecting in this case? or can the browser just stay on the non-canonical page if it serves the correct content?
404 + redirecting
This looks like the solution @lex111 implemented here: https://github.com/facebook/docusaurus/pull/2704 Which was not merged due to SEO reasons related to serving 404.
I found this note here: https://github.com/rafrex/spa-github-pages
I’d prefer not to do that as well but that remains an option.
What do you think?