mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Add example code to Summaries
I was initially confused about how to use summaries. The only example code I found in the docs was on the page for list nodes, but that uses `Render "summary"`, which is for views, not an article summary. I thought a little example here might clarify the issue for future users.
This commit is contained in:
parent
d376314763
commit
e6c27f76aa
1 changed files with 11 additions and 0 deletions
|
@ -29,3 +29,14 @@ If the summary content divider exists within a piece of content, Hugo will split
|
|||
When using user-defined summaries, <code><!--more--></code>, Hugo will preserve the HTML in the summary.
|
||||
|
||||
The summary content divider only applies to the content that it appears in.
|
||||
|
||||
## Showing Summaries
|
||||
|
||||
You can show content summaries with the following code. You could do this, for example, on a [list](/templates/list/) node.
|
||||
|
||||
{{ range first 10 .Data.Pages }}
|
||||
<div class="summary">
|
||||
<h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
|
||||
{{ .Summary }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue