Some posts don't generate excerpts #19
-
I'm rewriting my personal website. Started with the wyam blog recipe and had pretty good results, but it seemed more complex than it had to be so I decided to give statiq a try. My top-level index displays a list of posts nicely... except for a single post that would not show an excerpt. In an effort to figure out the cause, I set up some test posts. Now I'm seeing that even simple text does not generate an excerpt. All of these things were working for me in wyam, so I must be missing something. Hoping for some suggestions as to what the problem might be. Are there differences in how excerpts are extracted in statiq? Beyond that, I'm thinking of setting up in a way that I can debug right into the statiq code in order to figure this out. Any pointers on how to set that up? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hmmm... I just realized that the posts without excerpts are all |
Beta Was this translation helpful? Give feedback.
-
It's a chicken-and-egg problem. The behavior you're seeing is actually baked into the Content pipeline (by this point in the code, Markdown has been evaluated into HTML, but Razor has not): The problem is that Razor isn't actually HTML, so trying to use an HTML library like AngleSharp to parse a The ordering comes into play because we could always try to find excerpts after the Razor engine evaluates a The best solution would be to remove that HTML filter, or at least let it also get excerpts for Razor, but I'd need a reliable way to do that for raw |
Beta Was this translation helpful? Give feedback.
It's a chicken-and-egg problem. The behavior you're seeing is actually baked into the Content pipeline (by this point in the code, Markdown has been evaluated into HTML, but Razor has not):
The problem is that Razor isn't actually HTML, so trying to use an HTML library like AngleSharp to parse a
.cshtml
file as if it were and then find the first<p>
is brittle at best, and was causing lots of bug reports. Since Razor (and other templating languages) can also use code, the excerpts for Razor files tended to be goofy even when they did work (they would contain things like@Html.Whatever()
right in the excerpt content). It only kind of worked in Wyam if you got lucky and the Razor didn't ha…