Skip to content

Instantly share code, notes, and snippets.

@wvuwebgist
Last active January 22, 2021 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wvuwebgist/d149c22aed588af4a05407832c9e2c5d to your computer and use it in GitHub Desktop.
Save wvuwebgist/d149c22aed588af4a05407832c9e2c5d to your computer and use it in GitHub Desktop.
CleanSlate (Liquid): Pull articles from a blog onto another page in the same site.
{% assign blog = site | get_page: 1234 %} <!-- Change this ID to your blog_index page's ID -->
{% assign articles = blog.articles | filter_articles: limit: 5 %}
{% if articles.length > 0 %}
<ul>
{% for article in articles.all %}
<li>
<a href="{{ article.url }}">{{ article.name }}</a>
{{ article.content['article-body'] | select_html: css_selector: 'p', limit: 2 }}
</li>
{% endfor %}
</ul>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment