infinite-jekyll
infinite-jekyll copied to clipboard
Can it work with excerpts?
Thanks so much for this amazing JS. I can't quite get it to work with my blog though as I'm using {{ post.excerpt }}
on my homepage rather than {{ post.content }}
. I also call a few different classes on my homepage. For example, on my posts the title is an H1 but on my homepage I have {{ post.title}}
set to an H2.
Is there an easy way to make this work without printing the fill post?
thanks in advance.
nate
@natelandau I can't figure out a way for posts to have multiple layouts with Jekyll, so it seems like this may be difficult right now. One alternative is to with CSS hide everything that's not the first paragraph, when a post is displayed on the front page, e.g.:
.blog-posts > .post > p + p {
display: none;
}
It's on my to-do list to rewrite Infinite Jekyll to use the built-in pagination feature though, which would make this use case super easy to implement, so I'll leave this issue open.
Another possible (and better) CSS solution in the meantime is to include both the excerpt and the post in every post, which you can hide and display depending on the context:
<div class="post-excerpt">{{ post.excerpt }}</div>
<div class="post-full">{{ post.content }}</div>
and:
/* Default to always hiding the excerpt */
.post > .post-excerpt {
display: none;
}
/* Hide the full post on the front page */
.blog-posts > .post > .post-full {
display: none;
}
/* Display the excerpt on the front page */
.blog-posts > .post > .post-excerpt {
display: block;
}
Let's fix this for real with #13