I’m hosting a static site with Netlify.
My site’s pages are all in a folder called ‘pages’. If I want to open something, it looks like this:
How can I hide the /pages path in the url?
I’m hosting a static site with Netlify.
My site’s pages are all in a folder called ‘pages’. If I want to open something, it looks like this:
How can I hide the /pages path in the url?
Yes. Are these the settings you are talking about?
yep. If you try tweaking these settings so to include pages
you might get the result you want. Let us know if you really can’t make it work.
I’ve tried messing around… included pages in the base directory and also the publish directory, nothing works though to hide pages
Usually then you’d use pages/ as the publish
directory in the settings you picture - then all the content in public/pages in your repo will be published at / instead of at /pages
I’m not clear as to whether you have other content outside of /pages - like /assets/logo.png - that are needed by the content in /pages or not. If so, my suggestion won’t work well, and you might instead store the content in /pages in / instead?
Yes, that’s exactly what I ended up doing after messing with the settings. I stored my HTML files in /
and just deleted the /pages
folder.
Not sure why choosing /pages
as the publish
directory didn’t work. I wanted my HTML files to be a bit more organized in a separate folder, but it’s not a problem.
glad you figured it out! it’s a pretty universal pattern to have the html pages on the root level of your directory (or at the very least, the index.html) but all the assets can live in subdirectories. Good thing its working now