statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.64k stars 236 forks source link

Manually setting BlogKeys.Excerpt #833

Open ibebbs opened 5 years ago

ibebbs commented 5 years ago

Hi,

Just upgraded to the latest version of Wyam (the new Wyam.Tool approach is fantastic, nice one!) and finding that my posts are no longer respecting the Excerpt section in the post's metadata. Instead the Blob recipe simply uses the first paragraph in the post as the excerpt which, for numerous posts, is not what I want.

Is there a way to override this behaviour (I'm sure there is but don't seem to be able to find it)? I know the BlogKeys.Excerpt key is termed 'output' so will probably have to use something in it's place. Any advice would be greatly appreciated.

Thanks

daveaglick commented 5 years ago

Sorry for the delayed response. You can try using a comment separator to indicate the excerpt. If the HTML comment <!—more—> or <!—excerpt—> is found, the excerpt will be the content of that comment’s parent element up to the comment. If you don’t want the excerpt to be part of the page, you can place it in a hidden <div>.

Does that satisfy your use case? If not, is support for excerpt content in the front matter something we should look at?

Sent with GitHawk

ibebbs commented 5 years ago

Hi Dave, thanks for getting back to me. I've tried adding <!--excerpt [content] --> comment tag into my post but it doesn't seem have had any effect.

Just to ensure we're on the same page, I used to be able to add an excerpt as part of a post's meta-data as shown here:

Title: Fluent Namespacing
Lead: Challenging a convention at the heart of modern C#
Excerpt: There is a convention at the heart of enterprise development and many modern development frameworks which seems to have been blindly adopted by the development community at large. I hope to challenge this convention as I believe changing it can provide many useful benefits in day to day development.
Published: 2019-05-09
Tags:
  - C#
  - Patterns

This would cause the text following 'Excerpt' to be used on the index page underneath the posts title and lead strings.

Now the site generator seems to ignore this metadata value and instead takes the first paragraph from the post which is often not what I want.

Any other suggestions for getting the behavior I'm looking for (i.e. returning it to how it used to work)?

Thanks in advance