-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Page Not Found error when using a static index.html #9146
Comments
Hello, I was able to reproduce the issue and I am willing to work on this issue. |
What is your Docusaurus version? Are you using v1? |
My personal feeling is that it's not a bug, and @vennilamahalingam I don't think you will be able to fix it without some dirty hacks. We can wait for @slorber's opinion. |
@Josh-Cena It happens on the latest version of Docusaurus and also on https://new.docusaurus.io. I believe it is a bug because the instructions to create a landing page fail with the same |
You keep referring to the v1 docs, which is confusing. I can reproduce on the latest version, but it would be helpful if you refer to the latest docs in https://docusaurus.io/docs/creating-pages instead. In Docusaurus v2+, you should never be using static index.html files; you can simply write JSX in your index.js. FYI, this is likely a wontfix, because the way Docusaurus works does not allow arbitrary HTML files to be rendered as part of the site without extra effort. |
Sorry for the confusion, I did not realize that I was referencing the
According to the documentation the index page created from
Other static htmls are working in Docusaurus v2, for example if I place an HTML under |
@Josh-Cena Thank you.
Layout component renders the headers and footer. You can replace the return jsx of the Home component in pages/index.js. Will that suffice your requirement ?
I use Version 2.x and what works for me is pages/test.js served under https://localhost:3000/test (just as the documentation proposes). No page is served from static folder to me. |
Yes, it's a known pain point that you can't remove CSS from a page. The fact that it only doesn't work with landing page is somewhat intriguing. Does it happen in a production build? |
@vennilamahalingam Yes, if I am able to remove Docusaurus' CSS, headers and footers from a page generated by
@Josh-Cena Yes, it happens with the latest version 2 build and also on docusaurus.new. Other static pages work well, the problem it's just with |
Just a quick update - I was able to show the static HTML by placing it inside an iFrame and changing export default function Home() {
return (
<iframe src="/path/to/your/file.html" title="Description" style={{height: '100vh', width: '100vw'}} />
);
} However I'll leave the issue open because this solution is a bit of a hack and I think it would be quite useful to be able to render a static HTML file in scenarios where Docusaurus shares the domain with an existing website that has its own CSS style. |
Thanks @slorber , running |
I'm not sure how we can document this properly, this is kind of an edge case. Also keep in mind that Docusaurus is just a SSG: what you see in If you find an idea/place to document this, I'm open for a PR as long as it does not force most users (99.9% do not need this) to read an extra useless wall of text. Sometimes adding more docs that only 1 person will ever need is the wrong thing to do. |
Replacing index.tsx with index.html is a useful feature |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Custom
index.html
pages placed under 'static/` are ignored and a Page Not Found error is returned.Reproducible demo
https://stackblitz.com/edit/github-34byye?file=static%2Findex.html
Steps to reproduce
Follow the instructions at https://v1.docusaurus.io/docs/en/site-creation#docs-landing-page:
Expected behavior
Custom HTML should be rendered when accessing https://host:3000/
Actual behavior
A Page Not Found error is generated:
Your environment
Self-service
The text was updated successfully, but these errors were encountered: