I have a Docusaurus site hosted under <SHAREPOINT_SITE_URL>/SitePages/dev
. The first time I visit the page from outside, I get <SHAREPOINT_URL/default.aspx
, a route which Docusaurus doesn’t understand.
But then as soon as I click any link within the site navigation, Docusaurus starts working perfectly and continues working unless I either:
a. Refresh the page
b. Open a new link to the site from outside
I need to be able to create links to documents in Docusaurus from outside of Docusaurus itself (e.g. via email or in private messages), so I can’t just tell users to rely on the internal navigation after they hit the initial 404 (and it’s just a bad user experience).
I’ve tried using @docusaurus/plugin-client-redirects with toExtensions: ['aspx']
and with fromExtensions: ['aspx']
and neither seem to make an impact.
I’ve tried using createRedirects
but I don’t really know what I’m doing and I don’t see a lot of great examples out there using @docusaurus/plugin-client-redirects for something like this.
createRedirects(existingPath) {
if (existingPath.endsWith('/default.aspx')) {
return existingPath.replace('/default.aspx', '');
}
return undefined;
},