Last active
January 22, 2021 20:19
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% 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