greystash
greystash

Reputation: 337

Jekyll - Generate pages for items in a collection (similar to posts)

I'm making a website/blog that catalogs DIY projects, currently I have each project as a post, and recent posts are displayed on the home page.

I've tried many ways to generate pages from a collection of .md files as jekyll does for posts but I can't get this working. Is this possible to do? or is there a way to automatically generate an html page for every .md file in a folder?

Here is a link to the page I'm working with. http://happy-swallow.cloudvent.net/

Thanks!

Upvotes: 5

Views: 2053

Answers (1)

marcanuy
marcanuy

Reputation: 23972

You can use Collections and specify to render each file in the collection folder as a page:

  • tell Jekyll to render individual collection pages, in _config.yml:

    collections: 
        my_collection: 
            output: true
    
  • Then create a folder named _my_collection (the folder name must start with an underscore) and every markdown file inside it will have a single page.

Upvotes: 3

Related Questions