Eleventy: What is the recommended practice: page1/index.md or page1.md?

Created on 15 Jan 2020  ·  3Comments  ·  Source: 11ty/eleventy

In an Eleventy site source:

├── page1
         ├── index.md
├── page2
         ├── index.md

or

├── page1.md
├── page2.md

Both directory structures should generate

├── page1
         ├── index.html
├── page2
         ├── index.html

What is the recommended approach?

education

Most helpful comment

I like to have folders for each content, so that I can put additional files (images, files to download) alongside the Markdown file.

Exemple:
https://github.com/nhoizey/nicolas-hoizey.com/tree/master/src/articles/2020/01/10/can-we-monitor-user-happiness-on-the-web-with-performance-tools

I chose this folders hierarchy so that permalinks are the same, without having to define a permalink attribute in templates.

All 3 comments

Either way works, obviously.* Really whichever works best for your preferred organizational structure. I personally prefer to use your Choice 2 just to have one fewer layer of subdirectories, but both give you the same output.

Edit:
*I wrote that early in the morning and didn’t realize then that it might sound dismissive. I assure you I didn’t intend that, and apologize in case it created that impression.

My understanding is that this is preferable:

pages
├── page1.md
├── page2.md

The src doesn't have to match the result, and if it did it could get unwieldy with a lot of entries.

I like to have folders for each content, so that I can put additional files (images, files to download) alongside the Markdown file.

Exemple:
https://github.com/nhoizey/nicolas-hoizey.com/tree/master/src/articles/2020/01/10/can-we-monitor-user-happiness-on-the-web-with-performance-tools

I chose this folders hierarchy so that permalinks are the same, without having to define a permalink attribute in templates.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zachleat picture zachleat  ·  3Comments

ndaidong picture ndaidong  ·  4Comments

kaloja picture kaloja  ·  3Comments

smaimon picture smaimon  ·  3Comments

robdodson picture robdodson  ·  3Comments