Using Jekyll to create a news for

Asked

Viewed 85 times

1

I’m having the following doubt as I create a news for? I have to add something inside the config.yml file?

Inside the _post folder I have the file 2015-03-03-Welcome-Jekyll.markdown

---
layout: post
title:  "Welcome to Jekyll!"
date:   2015-03-03 14:47:43
categories: "jekyll update"
---

If I do so in a little view

{% for post in site.posts limit:20 %}  
            <li>  
                <span>{{ post.date | date_to_string }}</span> &raquo;  
                <a href="{{ BASE_PATH }}{{ post.url }}">  
                     {{ post.title }}
                </a>  
            </li>  
{% endfor %} 

It works fine, but if I rename the _posts folder to _notices and switch to the site.notices loop and run it doesn’t work. My doubt is how I can create news, testimonials?

1 answer

1


In Jekyll there is a concept called "Collections". An example is the collection of post which is created by default with the directory files _post.

To create a new collection you need to declare it on _config.yml. For example:

collections:
  news:
    output: true
# outras configurações...

Files should be in a directory _news.

Check out the documentation for more options in file generation and format customization: http://jekyllrb.com/docs/collections/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.