Comments (4)
Regarding my specific case with GitLab artifacts deployment for merge requests, I couldn't find the ability to implement a redirect on the GitLab side. GitLab integration requires an index.html file for viewing artifacts of MR.
I added a workaround trick to replace the URL on the client side. It looks messy, and I don't like it, but it resolved the issue. Perhaps it can be helpful to someone else:
// docusaurus.config.ts
import type {Config, HtmlTagObject} from '@docusaurus/types';
// see https://github.com/facebook/docusaurus/issues/9916
const redirect = `
(function() {
var pathname = window.location.pathname;
if (pathname.endsWith('index.html')) {
history.replaceState(
null,
pathname,
pathname.replace('index.html', '')
);
}
})();
`.replace(/\n/g, '');
const config: Config = {
// ...
headTags: [
{
tagName: 'script',
attributes: {
src: 'data:text/javascript,' + redirect,
},
},
] satisfies HtmlTagObject[],
};
from docusaurus.
We'll try to fix this for V4 in #10059
from docusaurus.
This has already been discussed here:
See my suggestions here: #9871 (comment)
You should serve pages by their canonical URLs. By default, this means serving them without the .html
extension.
If this is a problem, there's often a "pretty URL" option on CDNs and static hosts you can turn on, otherwise you can use reverse proxy settings.
from docusaurus.
Thanks for your response and valuable feedback! Maybe it would be helpful to mention about new behavior at the migration guides. I followed the instructions step by step, but this behavior was unexpected.
from docusaurus.
Related Issues (20)
- Index pages cannot be generated with an automatically generated siderbar HOT 1
- Document solution to "docs last update" date being rendered incorrectly when published through Vercel
- Customizing admonitions not work HOT 3
- When testing on StrictMode, the bar remains on the top HOT 1
- Node.js building getting stuck HOT 2
- Updating to @mdx-js/react 3.0.1 causes admonition blocks to stop rendering colored box HOT 8
- The <!--truncate--> line in my long blog post on the initialized website is not causing the blog post size to be limited. HOT 1
- Add trailing slash to auto generated sitemap.xml for directories only HOT 3
- blogTitle not working HOT 4
- Algolia Contextual Search Generates Incorrect FaceFilters HOT 6
- Multi-Instance Routes Not Working in v3.2.1 HOT 3
- Home page renders twice, one below the other. HOT 1
- Details elements aren't searchable - a11y issue HOT 8
- WARNβ 1 deprecated subdependencies found: [email protected] HOT 1
- npm run build fails when nmetadata are missing HOT 3
- Broken link transformation HOT 2
- Ability to Skip Homepage and Directly Access Feature Page HOT 1
- Light/Dark Mode issues on older versions of Safari 12,13, and 14 HOT 3
- Problems with locale url on homepage and blog HOT 1
- Proposal: createSitemapItems hook - a sitemap equivalent to createFeedItems
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docusaurus.