I use <!--more--> to separate a page into a summary and it’s content. The summary is also displayed on another page, where I link to this page.
Now I would like to have a different style for the summary on the actual page. How can I display the content of a page without it’s summary? So I can do something like:
The summary feature is for generating the snippet to show in a summary view, so isn’t what you are looking for. You might consider using .Description instead, or another arbitrary front matter parameter.
This is untested. But you could use split on .RawContent to single out your two chunks.
Then you may or may not have to use mardownify when displaying them (not sure). Should look somehting like this:
If you want to display content of the page without the summary consider hiding the summary using a CSS display property such as display:none to remove it from the document flow. Note it’s best to keep the content in the page and surround it with an article tag for semantic purposes and spiders.
Note not all individuals will be navigating your site the way you expect and if they drop directly into the page without the summary they may not understand the content they way you intended.
Another thing to keep in consideration is the presentation for aural user agents such as screen readers. If you use display:none to hide the summary this will also tell the screen reader not to read it.
If your intent is only to hide it for display purposes but to keep it readable to aural user agents you can use one of the many glorious hacks I’m intended to solve with the visibility:aural CSS property.
Finally, if you haven’t seen it yet, you may want to check out the following feature of Hugo:
Well, if a regex - as suggested by @TotallyInformation - doesn’t work for you and this does not either, you’ve got little options left.
You could try and extract the content you need in multiple steps with various string functions. But honestly, if there’s no easy way to do it, you’re going against the framework. That is never a good idea IMO. My recommendation would be to rethink your template design.