Eleventy: How can I serve collection from root? (blog)

Created on 11 Oct 2020  路  4Comments  路  Source: 11ty/eleventy

I'm moving my WP blog over to eleventy.

I have a posts collection in /site/blog/post1/index.md and this is rendered as /dist/blog/post1/index.html.

I would like yo serve it from the root of my site so it should become /dist/post1/index.htm.

So like http://example.com/blog/post1.html should be http://example.com/post1.html actually.

How can I do that?

education

Most helpful comment

If you want to have your /site/blog/post1/index.md files served as /post1.html, you should be able to create a directory config file named /site/blog/blog.json and set a permalink property (which should get applied to all the /site/blog/*/ files):

{
  "permalink": "/{{ page.fileSlug }}.html"
}

https://github.com/pdehaan/11ty-1444/blob/master/site/blog/blog.json

All 4 comments

If you want to have your /site/blog/post1/index.md files served as /post1.html, you should be able to create a directory config file named /site/blog/blog.json and set a permalink property (which should get applied to all the /site/blog/*/ files):

{
  "permalink": "/{{ page.fileSlug }}.html"
}

https://github.com/pdehaan/11ty-1444/blob/master/site/blog/blog.json

Thank you. Exactly what I need.

If you feel that your problem has been solved, please close this issue.

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zac-heisey picture zac-heisey  路  3Comments

smaimon picture smaimon  路  3Comments

ndaidong picture ndaidong  路  4Comments

jamrelian picture jamrelian  路  3Comments

robdodson picture robdodson  路  3Comments