Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialEric Tirado
iOS Development Techdegree Student 7,036 PointsIs it possible to make a custom post type in Jekyll like "News" I want it to have its own categories.
I'd like to make custom post types like News, Recipes, Blog, and each will have their own categories and tags and liquid variables. Is that possible with Jekyll? I'm trying to wrap my head around how to go about it.
When you make a post in the _Posts folder, you can use Front Matter to specify the Layout, Title, Date, Category, and it will automatically be laid out after the Posts layout template. I'm wondering if I can make a template for News, make posts under a _news folder, and have them automatically be generated under the News _layout, and use liquid variables to pull out the content from the news posts on a page like the example below:
<ul class="news">
{% for post in paginator.news %}
<li class="news__item">
<a class="news__title" href="{{ post.url | prepend: site.baseurl }}">{{ news.title }}</a>
<div class="news__meta">
<b class="news__author">{{ news.author }}</b>
<b class="news__sep">●</b>
<b class="news__date">{{ news.date | date: "%b %-d, %Y" }}</b>
</div>
{{ news.excerpt }}
<a class="btn--default" href="{{ news.url | prepend: site.baseurl }}">Read more</a>
</li>
{% endfor %}
</ul>
1 Answer
Robert Conaty
10,736 PointsJekyll already has a 'categories' field in the post template but it looks like you want something more advanced.
There's a very comprehensive explanation of how to build multi-blog Jekyll sites in this post by Guillermo Garron: https://www.garron.me/en/blog/multi-blog-site-jekyll.html
Maybe that will help you.
Good luck!