Controlling start of or contents in .Summary?

I see that you can specify <!--more--> to cause the break for .Summary. Is there any way to exclude things from summary? Or trigger the start of summary?

I’m trying to add a stylized block quote at the top of some pages. This is included within my Summary and doesn’t really make sense when not offset.

The only work around I have come up with is either a page variable where I define my own summary and use this if it exists or .Summary.

I’d be find is summary used only md outside of any tags. But it seems like this is done post processing and just stripping HTML tags.

Try using the replace or replaceRE functions with .Summary and see if you can add what you need at the start of your summary.

I woud suggest you put those quotes into front matter params and check for existence in templates.

You can style the first paragraph as if it were a lead/blockquoute at the page level; that is, using pseudoselectors.

As far as using the summary in list views, why not just <blockquote><p>{{.Summary}}</p></blockquote>?

Otherwise, I’ve never been a fan of summary because it’s not really a summary as much as often a lead paragraph (at least with Hugo). I prefer to use .Description.

That said, I think I’m missing something :smile: Does that help?

1 Like

Man, look at that service! I start writing a response, finish my lunch, come back on this thread on my phone and finish my response and there are already two responses, haha :laughing:

The issue was that my blockquote was getting pulled into Summary.

I can see how Description will be more work for each page, but be better what I’m trying to get across. That is probably the easiest method, as it ignores the body text all together, block quote or not.

Edit: This is what I ended up with:

{{ .Description | default .Summary }}

Allows me to be lazy where it makes sense, or give specifics where it is needed.


Even better. I forgot to mention default! :smile:

1 Like

Here’s an alternative solution: