-
-
Save nimbupani/1421828 to your computer and use it in GitHub Desktop.
--- | |
layout: default | |
--- | |
<div class="blog-index"> | |
{% assign post = site.posts.first %} | |
{% assign content = post.content %} | |
{% include post_detail.html %} | |
</div> |
<h1 class="entry-title"> | |
{% if page.title %} | |
<a href="{{ root_url }}{{ page.url }}">{{ page.title }}</a> | |
{% endif %} | |
{% if post.title %} | |
<a href="{{ root_url }}{{ post.url }}">{{ post.title }}</a> | |
{% endif %} | |
</h1> | |
<div class="entry-content">{{ content }}</div> |
For some reason it doesn't work in displaying the title when the post is accessed directly on my setup :( I'll see if I can work out why
Nice! Saved me some tryouts!
Nice! Mind if I use this in a blog post series I intend to start on Jekyll tips and tricks? Credit will be given.
Thanks! Helped me a lot!
Awesome! I am gonna use this in my site. Thanks :-)
Awesome, thank you!
Awesome!
Add {% assign page = post %}
if the title does not show up.
Anyone still using this know if it's possible to add pagination to it that points to prev post and not '/blog/page/2' ?
Do you know why am I showing more than the first post?
Working good! 😄
🍻
🍻 what he said ^^
Since this is still a topic of interest several years later, it's probably worth mentioning the Jekyll Bootstrap docs.
Awesome hack!
Works! Thank you so much.
Works like a charm. Thanks!
Hi there, I know I'm a bit late, but thanks! Just what I was looking for.
many thanks buddy!
Thanks! this helped me understand Jekyll and get started with some templating...
Thank you. Just what I was looking for. Even after so many years.
Thanks a lot. I just needed a simple link to the latest post and reading your stuff helped me.
Just FYI for others: <a href="{{site.posts.first.url}}">{{site.posts.first.title}}</a>
I know this is a bit late, but now how do you show the rest of your posts if you're using pagination? I know an easy way would be to do offset:1
, but with pagination this offsets the first post on each page, which is not what I want. Is there a way to use assign
, i.e. {% assign remainingposts = site.posts offset:1 %}
or something like that?
I just added this into _layouts/home.html . Works like a charm.
👍