Last active
March 4, 2021 23:09
-
-
Save wvuwebgist/023a0ef7bd5617bf6cea1b1555b0ab01 to your computer and use it in GitHub Desktop.
CleanSlate (Liquid): Add a featured blog post to a page on your 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: tags: "featured", limit: 1 %} | |
{% for article in articles.all %} | |
<article class="wvu-article"> | |
<h2 class="wvu-article__title"><a href="{{ article.url }}">{{ article.name }}</a></h2> | |
<p class="wvu-article__meta"> | |
{{ article.author.full_name }} | | |
<time class="wvu-article__date" datetime="{{ article.published_at | date_iso8601 }}">{{ article.published_at | date: '%A, %B %d, %Y' }}</time> | |
</p> <!-- /.wvu-article__meta --> | |
<div class="wvu-article__body" itemprop="articleBody"> | |
{{ article.content['article-body'] | select_html: css_selector: 'p', limit: 1 }} | |
</div> <!-- /.wvu-article__body --> | |
<p><a href="{{ article.url }}">Read Full Article</a></p> | |
</article> <!-- /.wvu-article --> | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment