block by roachhd 0991292c575536db96c5

JEKYLL TIPS 💎. list of posts with excerpt - description or content.

#JEKYLL TIPS 💎.

List of posts with excerpt, description or full post content.

List of posts with except

<ul>
  {% for post in site.posts %}
    <li>
      <a href="{{ post.permalink }}">{{ post.title }}</a>
      <p>{{ post.excerpt }}</p>
    </li>
  {% endfor %}
</ul>

List of posts with full content

<ul>
  {% for post in site.posts %}
    <li>
      <a href="{{ post.permalink }}">{{ post.title }}</a>
      <p>{{ content }}</p>
    </li>
  {% endfor %}
</ul>

List if posts with post description

<ul>
  {% for post in site.posts %}
    <li>
      <a href="{{ post.permalink }}">{{ post.title }}</a>
      <p>{{ post.description }}</p>
    </li>
  {% endfor %}
</ul>

Pages

List of Pages with description. (change to excerpt or content)

<ul>
  {% for post in site.page %}
    <li>
      <a href="{{ page.permalink }}">{{ page.title }}</a>
      <p>{{ page.description }}</p>
    </li>
  {% endfor %}
</ul>

post can be replaced with page or even site depending on your need.

See Jekyll Docs for more details.


List of posts/pages in a category

on _config.yml add your index of categories:

categories: [bacon, dogs, cows, mull, stink]

on your page.md inside the front matter add one or more of the categories available in the _config.yml

---
layout: page
title: Stinky Trees
description: Mull Congress from stinky trees.
categories: [stink, mull]
---

on your template to get all the pages in the stink category you do:

{% for page in site.pages %}
  {% if page.categories contains 'stink' %}
    <div class="item">
      <h3><a href="{{ page.url }}">
        {{ page.title }}
      </a></h3>

      <p>{{page.description}}</p>  
    </div>
  {% endif %}
{% endif %}