Doug Smith
Doug Smith

Reputation: 29316

How do I remove the .html extension from not only posts, but pages as well in Jekyll?

In my config file for Jekyll, I have the permalink set to permalink: /:year/:month/:day/:title/ so that the HTML extension is removed from the post, but this only works for markdown posts, not pages as well.

If I want all my pages to have the .html removed, such as my about.html page change to just /about, do I have to create the folder then have the index.html, or is there a way Jekyll can do that for me?

Upvotes: 2

Views: 290

Answers (2)

Amarjeet Singh
Amarjeet Singh

Reputation: 448

Check this setting for YAML config file:

#for all pages
permalink: pretty

#for posts
defaults:
  - scope:
     path: ""
     type: "posts"
    values:
     permalink: /blog/:title

Upvotes: 0

David Jacquel
David Jacquel

Reputation: 52799

This setting in _config.yml will work :

# applies pretty for all
permalink: pretty

# overrides permalink for posts
defaults:
  -
    scope:
      path: ""
      type: "posts"
    values:
      permalink: /:year/:month/:day/:title/

Note that a permalink in a page front matter will override the one in config.

Upvotes: 1

Related Questions