Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorphilgs <phil.gs@gmail.com>2015-01-05 14:15:49 +0300
committerbep <bjorn.erik.pedersen@gmail.com>2015-01-05 20:44:25 +0300
commite6c27f76aa8a3f2b03f082c9c869e7a6269d6249 (patch)
tree1255c83682c845cae95879f8fd3414256034c764 /docs
parentd376314763722f2523901fe23d9464ef069b892a (diff)
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.
Diffstat (limited to 'docs')
-rw-r--r--docs/content/content/summaries.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/content/content/summaries.md b/docs/content/content/summaries.md
index 35acaaddb..01179e2a6 100644
--- a/docs/content/content/summaries.md
+++ b/docs/content/content/summaries.md
@@ -29,3 +29,14 @@ If the summary content divider exists within a piece of content, Hugo will split
When using user-defined summaries, <code>&#60;&#33;&#45;&#45;more&#45;&#45;&#62;</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 }}