Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can it work with excerpts? #5

Open
natelandau opened this issue Jan 11, 2014 · 3 comments
Open

Can it work with excerpts? #5

natelandau opened this issue Jan 11, 2014 · 3 comments

Comments

@natelandau
Copy link

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

@tobiasahlin
Copy link
Owner

@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.

@tobiasahlin
Copy link
Owner

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;
}

@tobiasahlin tobiasahlin added this to the Infinite Jekyll 2.0 milestone Sep 13, 2014
@tobiasahlin
Copy link
Owner

Let's fix this for real with #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants