Reputation: 7256
If there are files called members/alice.md
and members/bob.md
, the Jekyll generated position will be members/alice.html
and members/bob.html
. How can I set them to be members/alice/index.html
and members/bob/index.html
?
Upvotes: 1
Views: 67
Reputation: 6947
You can do this with Permalinks.
Here are 2 approaches that may suit you:
1. Per-page YAML frontmatter
If you just want specific pages to have that behavior, just add a permalink:
option in your YAML frontmatter for your Markdown post.
For example: In members/alice.md
's YAML frontmatter add:
---
permalink: members/alice/
---
2. Edit the _config.yml
file
As per the documentation I've linked above, the simplest way (which I recommend) way to achieve this is with Jekyll's built-in pretty
option.
Add this in your _config.yml
:
permalink: pretty
This removes the .html from the static output by making all posts have their own folder and named as index.html.
Your browser would then display this as yoursite.com/members/alice/
, note that the index.html
is hidden, a behavior on most browsers. If you head on over to peek at the output _site
folder, you'll see a folder in members
named alice
, and a file index.html
inside.
Also note that:
You need to restart the Jekyll server every time you make a change in _config.yml
, unlike other files that the Jekyll server will detect changes and regenerate, this configuration file will not and the WEBrick server must be restarted for changes to take effect. :)
You could also refer to the documentation on other more customizable options as well. Here's also a tutorial for reference too.
Upvotes: 2