I’m trying to set up Jekyll so that a quote from the first post in the list of posts is displayed in a sidebar, but I can’t quite work out how to do it. I have the quote text defined as a quote variable within the YML Front Matter in each post’s Markdown.
This is the relevant extract from my default.html:
<div id="content">
{{ content }}
</div>
<div id="sidebar">
<blockquote>{{ page.quote }}</blockquote>
</div>
And this is my index.html:
---
layout: default
quote: ** Can a variable referencing the first post go here? **
---
{% for post in site.posts limit:10 %}
<h2>{{ post.title }}</h2>
<div class="post">
{{ post.content }}
</div>
{% endfor %}
After much experimentation, I was able to solve the problem using this Liquid snippet within default.html: