Pages don't work without adding ".html"

I’m working on a new site: https://sidey.diklein.now.sh
The navigation works locally. I can click on “About” and “Writing” and see the resulting markdown pages.
When I upload to Vercel I can’t get to the About and Writing pages. I need to manually add “.html” to make them work. How can I fix this? I’d like “/about” and “/writing” to work without “.html”.

Thanks.

Ah I figured it out. You need permalink: /text/ at the top for every page.

probably don’t need to do that to every page, you can set it in the config file.

permalink: pretty will give you pretty basic nice looking urls - though they will have a trailing slash - but won’t have an extension.

So you could get /about/ but not /about. To loose the trailing slash you need to do work on the web server as that is normally something it would handle.

I have permalink: pretty in my config file already! Weird.

then something is overriding it maybe - so you are saying with no permalink in the front matter of a post you still have to add the .html to the url? that should not be the case, with pretty set the structure should be such that each page/post goes into its own folder with the title (?) as the folder name, then inside that is an index.html file which any browser should serve up automatically if you hit the folder - so /my-post/ should work as the url no problem.

Interesting that you are able to have no trailing slash’s on your urls - which again is not normal for pretty i don’t think.

If you still need help post a link to a repo so we can see what all is there.

so you are saying with no permalink in the front matter of a post you still have to add the .html to the url?

Yes indeed. Very strange.

Here is the repo:

Thank you so much for taking a look.

Oh! That extra slash actually breaks the logic for bolding the current page in the navigation. Shoot.

in your config you are overridding the pretty setting here:

collections:
  pages:
    output: true
    permalink: /:name
  posts:
    output: true
    permalink: /:year/:month/:day/:slug

which isn’t really a problem.

I think your host is able to drop the trailing slash which is why your nav works as is - the file for about is really in a folder named about, inside of which is an index.html being served when you hit /about.

Your posts are probably not in folders like that - they most likely are just files like my-post.html but your webserver is not serving those as extensionless. Maybe it could and you could do that instead? but I would try to get all the urls the same - so either with index files in sub folders or all as file names.html.

If you put a trailing slash on both permalinks in the above code, I would think it will break your nave, but then the posts will all work? if so then just fix the nav, which looks like it is in sidey/_includes/navigation.html - personally I would just hard code the 3 links there.

I agree permalink pretty is the way to go. But a caution on that the 404 page becomes 404/index.html in files which is accessed by /404/ and then does NOT work as expected locally or on Netlify

So update metadata of 404.html

permalink: /404.html
1 Like

Thank you both so much.
I changed this in my config.yml to turn off the permalink overrides:

collections:
  pages:
    output: true
    # permalink: /:name
  posts:
    output: true
    # permalink: /:year/:month/:day/:slug

I removed permalink: /about/ from about.markdown.
I removed permalink: /writing/ from writing.markdown.

Now I can’t get to http://127.0.0.1:4000/writing. I just see the 404. What do you think?

looks like you got it working?

Yes it works with all the extra code that I assumed permalink: pretty would take care of.

1 Like

I had a similar issue today, the permalink: pretty was not working neither the permalink: /:title, so I found a theme online which was using permalink: "/:title/". I did the same thing on my blog and it worked!

1 Like