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

Excerpts include layout! #1321

Closed
6twenty opened this Issue Jul 17, 2013 · 22 comments

Comments

Projects
None yet
@6twenty

6twenty commented Jul 17, 2013

Commit 015ace6 introduced self.extracted_excerpt.do_layout(payload, layouts) on line 255 of lib/jekyll/post.rb. For me, this caused all of my post excerpts to render with the layout. Using Maruku, this was cause build errors as it was unable to parse the crazy HTML; using Redcarpet the build would succeed but my page would be full of broken HTML.

I was able to resolve my issue by commenting out this line; I'm not sure though what the original purpose of this line was so I'm not yet submitting a pull request for this change.

@rwboyer

This comment has been minimized.

Show comment
Hide comment
@rwboyer

rwboyer Jul 17, 2013

See bug #1307 and my comment on that line - you effectively just un-did that feature.

rwboyer commented Jul 17, 2013

See bug #1307 and my comment on that line - you effectively just un-did that feature.

@6twenty

This comment has been minimized.

Show comment
Hide comment
@6twenty

6twenty Jul 17, 2013

I should add that Maruku only complains when the excerpt is being markdownified (eg {{ post.except | markdownify }})

6twenty commented Jul 17, 2013

I should add that Maruku only complains when the excerpt is being markdownified (eg {{ post.except | markdownify }})

@6twenty

This comment has been minimized.

Show comment
Hide comment
@6twenty

6twenty Jul 17, 2013

So self.extracted_excerpt.do_layout(payload, layouts) is to allow Liquid within excerpts? This sounds like the wrong approach to the problem, no?

6twenty commented Jul 17, 2013

So self.extracted_excerpt.do_layout(payload, layouts) is to allow Liquid within excerpts? This sounds like the wrong approach to the problem, no?

@mattr-

This comment has been minimized.

Show comment
Hide comment
@mattr-

mattr- Jul 17, 2013

Member

@6twenty Sorry, but I'm a bit confused. Which problem are you referring to?

I think you should be able to fix your issue if you don't markdownify your excerpt. Does removing the markdownification help at all?

Member

mattr- commented Jul 17, 2013

@6twenty Sorry, but I'm a bit confused. Which problem are you referring to?

I think you should be able to fix your issue if you don't markdownify your excerpt. Does removing the markdownification help at all?

@6twenty

This comment has been minimized.

Show comment
Hide comment
@6twenty

6twenty Jul 17, 2013

The issue is that {{ post.excerpt }} is rendering the entire layout instead of just the excerpt. So the issue remains with or without markdownify.

6twenty commented Jul 17, 2013

The issue is that {{ post.excerpt }} is rendering the entire layout instead of just the excerpt. So the issue remains with or without markdownify.

@6twenty

This comment has been minimized.

Show comment
Hide comment
@6twenty

6twenty Jul 17, 2013

As far as I can tell, self.extracted_excerpt.do_layout(payload, layouts) is changing the content of post.excerpt. Prior to this line I can see that my posts excerpts are being generated fine; after this line, the excerpts are being wrapped with the layout.

Also please note that my excerpts are being generated via the built in excerpt_separator; not as part of the YAML front matter. I've done a test putting the excerpt into the YAML front matter and it seems to work fine; so perhaps there's an issue in how Jekyll automatically extracts the excerpt from the post content?

6twenty commented Jul 17, 2013

As far as I can tell, self.extracted_excerpt.do_layout(payload, layouts) is changing the content of post.excerpt. Prior to this line I can see that my posts excerpts are being generated fine; after this line, the excerpts are being wrapped with the layout.

Also please note that my excerpts are being generated via the built in excerpt_separator; not as part of the YAML front matter. I've done a test putting the excerpt into the YAML front matter and it seems to work fine; so perhaps there's an issue in how Jekyll automatically extracts the excerpt from the post content?

@6twenty

This comment has been minimized.

Show comment
Hide comment
@6twenty

6twenty Jul 17, 2013

Here's a simplified example of the malformed output from {{ post.excerpt }}:

<!DOCTYPE html>
<html>
  <head>
    [snip]
  </head>
  <body>
    <article>
      <!-- This is where {{ post.excerpt }} was -->
      <!DOCTYPE html>
      <html>
        <head>
          [snip]
        </head>
        <body>
          <!-- This is where the actual excerpt ends up -->
          [snip]
        </body>
      </html>
    </article>
  </body>
</html>

6twenty commented Jul 17, 2013

Here's a simplified example of the malformed output from {{ post.excerpt }}:

<!DOCTYPE html>
<html>
  <head>
    [snip]
  </head>
  <body>
    <article>
      <!-- This is where {{ post.excerpt }} was -->
      <!DOCTYPE html>
      <html>
        <head>
          [snip]
        </head>
        <body>
          <!-- This is where the actual excerpt ends up -->
          [snip]
        </body>
      </html>
    </article>
  </body>
</html>
@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jul 17, 2013

Member

This specific problem can be solved by just overriding render_all_layouts and setting self.output = self.content and leaving it at that. I'm having trouble testing now where the output isn't set soon enough or something so I'm getting the un-transformed content on the page (#to_s is called but self.output is nil). I'll keep working on it.

Member

parkr commented Jul 17, 2013

This specific problem can be solved by just overriding render_all_layouts and setting self.output = self.content and leaving it at that. I'm having trouble testing now where the output isn't set soon enough or something so I'm getting the un-transformed content on the page (#to_s is called but self.output is nil). I'll keep working on it.

@rwboyer

This comment has been minimized.

Show comment
Hide comment
@rwboyer

rwboyer Jul 17, 2013

from my point of view this is all pretty much the same issue as #1307 and it all stems from:

self.extracted_excerpt.do_layout(payload, layouts)

without any regard to context...

rwboyer commented Jul 17, 2013

from my point of view this is all pretty much the same issue as #1307 and it all stems from:

self.extracted_excerpt.do_layout(payload, layouts)

without any regard to context...

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Jul 17, 2013

Member

we simply can't know about context. we need to convert and parse liquid as is without the layout.

Member

parkr commented Jul 17, 2013

we simply can't know about context. we need to convert and parse liquid as is without the layout.

@WickyNilliams

This comment has been minimized.

Show comment
Hide comment
@WickyNilliams

WickyNilliams Jul 17, 2013

Just came to report the exact same bug - I noticed this issue when upgrading also.

{{page.excerpt}} will literally render the the HTML of the page, up to the end of the first paragraph. The DOM is left completely malformed. For now I can work around it by manually assigning excerpts in each post, but that's far from ideal.

WickyNilliams commented Jul 17, 2013

Just came to report the exact same bug - I noticed this issue when upgrading also.

{{page.excerpt}} will literally render the the HTML of the page, up to the end of the first paragraph. The DOM is left completely malformed. For now I can work around it by manually assigning excerpts in each post, but that's far from ideal.

@thenayr

This comment has been minimized.

Show comment
Hide comment
@thenayr

thenayr Jul 18, 2013

screen shot 2013-07-17 at 10 37 59 pm
Same issue after upgrade, excerpts render with the full layout as mentioned above. Manual yaml front matter excerpts render fine.

thenayr commented Jul 18, 2013

screen shot 2013-07-17 at 10 37 59 pm
Same issue after upgrade, excerpts render with the full layout as mentioned above. Manual yaml front matter excerpts render fine.

@miyagawa

This comment has been minimized.

Show comment
Hide comment
@miyagawa

miyagawa Jul 18, 2013

Same problem with post.excerpt having the entire layout, breaking index and feeds.

miyagawa commented Jul 18, 2013

Same problem with post.excerpt having the entire layout, breaking index and feeds.

@flxw

This comment has been minimized.

Show comment
Hide comment
@flxw

flxw Jul 19, 2013

Just encountered the same problem as miyagawa to notice a nice effect of inceptiooooon :D
2013-07-19-224321_989x728_scrot

flxw commented Jul 19, 2013

Just encountered the same problem as miyagawa to notice a nice effect of inceptiooooon :D
2013-07-19-224321_989x728_scrot

@rwboyer

This comment has been minimized.

Show comment
Hide comment
@rwboyer

rwboyer Jul 19, 2013

FYI - @parkr pulled 1.1.0 because of the fallout of rendering liquid in excerpts so...

back to 1.0.3 for everyone I guess - I sorta figured...

Just encountered the same problem as miyagawa to notice a nice effect of inceptiooooon :D

rwboyer commented Jul 19, 2013

FYI - @parkr pulled 1.1.0 because of the fallout of rendering liquid in excerpts so...

back to 1.0.3 for everyone I guess - I sorta figured...

Just encountered the same problem as miyagawa to notice a nice effect of inceptiooooon :D

@WickyNilliams

This comment has been minimized.

Show comment
Hide comment
@WickyNilliams

WickyNilliams Jul 20, 2013

Where did you find that info, @rwboyer?

WickyNilliams commented Jul 20, 2013

Where did you find that info, @rwboyer?

@rwboyer

This comment has been minimized.

Show comment
Hide comment
@rwboyer

rwboyer Jul 20, 2013

It's in the jekyll issues threads that I have been following all week since opening some bugs...

[https://github.com/mojombo/jekyll/issues/1329]

rwboyer commented Jul 20, 2013

It's in the jekyll issues threads that I have been following all week since opening some bugs...

[https://github.com/mojombo/jekyll/issues/1329]

@WickyNilliams

This comment has been minimized.

Show comment
Hide comment
@WickyNilliams

WickyNilliams Jul 20, 2013

Thanks mate, back to 1.0.3 it is then :)

WickyNilliams commented Jul 20, 2013

Thanks mate, back to 1.0.3 it is then :)

@parkr parkr closed this Jul 20, 2013

@parkr parkr reopened this Jul 20, 2013

This was referenced Jul 20, 2013

@mattr- mattr- closed this in #1339 Jul 24, 2013

@6twenty

This comment has been minimized.

Show comment
Hide comment
@6twenty

6twenty Jul 24, 2013

Thanks @parkr and @mattr- -- your hard work is very much appreciated! 😃

6twenty commented Jul 24, 2013

Thanks @parkr and @mattr- -- your hard work is very much appreciated! 😃

@joaoafrmartins

This comment has been minimized.

Show comment
Hide comment
@joaoafrmartins

joaoafrmartins Feb 23, 2014

hey! i am having this issue on version 1.4.3 when using autogenerated excerpts

joaoafrmartins commented Feb 23, 2014

hey! i am having this issue on version 1.4.3 when using autogenerated excerpts

@flashlib

This comment has been minimized.

Show comment
Hide comment
@flashlib

flashlib Feb 27, 2014

@joaoafrmartins Please check if your file format is 'dos'. My excerpts get work after I change the file type form 'dos' to 'unix'.

flashlib commented Feb 27, 2014

@joaoafrmartins Please check if your file format is 'dos'. My excerpts get work after I change the file type form 'dos' to 'unix'.

@joaoafrmartins

This comment has been minimized.

Show comment
Hide comment
@joaoafrmartins

joaoafrmartins Feb 27, 2014

@flashlib no in my case is not because of EOL but thank you!

joaoafrmartins commented Feb 27, 2014

@flashlib no in my case is not because of EOL but thank you!

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.