Search code examples
jekyll

Build pages with slug.html rather than slug/index.html in Jekyll (ugly URLs)


I have a page with the slug about-us. By default, Jekyll builds this:

/about-us
         /index.html

However, I want this instead:

/about-us.html

Reading through the Permalinks documentation, it looked like I could use this in the config

permalink: /:slug:output_ext

However, this produces the same output as above.

How I configure Jekyll to write the pages as their own .html page, rather than in a folder with an index.html?


Solution

  • Jekyll only generates /about-us/index.html if you've permalink: /about-us/ in the page's front matter or if you've permalink: pretty in your config file.

    Ensuring neither of the above conditions should generate /about-us.html