2

I created a landing page for my octopress website and I'd like to have the most recent blog post displayed on the home page, but just the most recent blog. I am not sure quite how to proceed. Is there a code like {% include post %} that will allow me to do this?

Thanks.

spasticninja
  • 681
  • 8
  • 16

1 Answers1

3

As per usual, I tend to find the solution after I ask it.

On home page:

<div class="blog-index">
  {% assign post = site.posts.first %}
  {% assign content = post.content %}
  {% include custom/asides/recent_post.html %}
</div>

In separate document saved to custom/asides/recent_post.html:

<h2 class="entry-title">
  {% if post.title %}
    <a href="{{ root_url }}{{ post.url }}" id="recent_post">{{ post.title }}</a>
  {% endif %}
</h2>
<div class="entry-content">{{ content | excerpt }}</div>
<a class="btn btn-default" href="{{ root_url }}{{ post.url }}">{{ site.excerpt_link }}</a>

Found solution here: https://gist.github.com/nimbupani/1421828

spasticninja
  • 681
  • 8
  • 16