I have problem deploying static website with nested html files and pages not found after deploying.
my netlify url website is : https://kodeal-website.netlify.app/
I have problem deploying static website with nested html files and pages not found after deploying.
@kiyan All files are being deployed to the same location you’ve shown in the screenshot.
For example:
https://kodeal-website.netlify.app/README.md
https://kodeal-website.netlify.app/package.json
https://kodeal-website.netlify.app/pages/
https://kodeal-website.netlify.app/pages/contact
If that isn’t what you want, then adjust your Build Configuration accordingly.
no they are not. html pages are in different folder . I mean maybe index.html is not recognized by netlify and how can I change build setting of netlify to find index.html
Hi, @kiyan. It looks like you need to do the following:
That should resolve the issue.
Yes, they are.
Which is proven by the links that I provided.
All of the files have been deployed precisely where they are in your screenshot.
It is the default behavior, when there is no ‘Build configuration’.
Yes, I understand that.
They’re in that same folder once deployed, as shown by the links.
Notice that the links are:
/pages/
which is /pages/index.html
/pages/contact
which is /pages/contact.html
If they were at the root, they’d be
/
which would be /index.html
/contact
which would be /contact.html
Netlify doesn’t search your files to find an index.html
You need to set the Build Configuration.
What you set depends on what your project requires and what you’re trying to achieve.
The documentation is here:
https://docs.netlify.com/configure-builds/overview/
As indicated by @luke, if you’re trying to have the files in Pages
be at the ‘root of the site’.
Then you would normally just set the Publish directory to Pages
.
But (and this is very important for your site), Netlify only deploy the files in the ‘Publish directory’.
All of your assets sit a level higher than Pages
, under /assets/
, /css/
, /js/
If you set your Publish directory to Pages
, none of those files will be deployed.
So your site would appear completely broken.
You can see the relative references to those files in your deployed html:
So simply setting your Publish directory to Pages
is absolutely not the answer in your case.
If I were you, I’d edit my project to change it’s structure, so the files aren’t nested under Pages
.
I would also change the asset references to be “root relative” (starting with /
) instead of relative (../
)