From 38f49445bfbcd1e03f773336a46d28e03d8539ac Mon Sep 17 00:00:00 2001 From: Guillermo Guerrero Ibarra Date: Wed, 18 Aug 2021 16:50:07 +0200 Subject: Summary example. (#315) * Summary example. * Update README.md --- README.md | 4 ++++ exampleSite/config.toml | 2 ++ exampleSite/content/blog/hugo-is-for-lovers.md | 1 + 3 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 50f5261..f3478f3 100644 --- a/README.md +++ b/README.md @@ -524,6 +524,8 @@ The recent posts sections shows the four latest published blog posts, with their You can enable it in the configuration file. ```toml +summaryLength = 70 + [params.recent_posts] enable = true title = "From our blog" @@ -531,6 +533,8 @@ You can enable it in the configuration file. hide_summary = false ``` +Recent posts use `.Summary` property and by default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. You may customize the summary length by setting summaryLength in your site configuration. + #### Footer In the footer there are three blocks customizables: `About us`, `Recent posts` and `contact`. Each block can be set via parameters. diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 7d25c3d..de68c02 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -10,6 +10,8 @@ disqusShortname = "devcows" # Enable Google Analytics by entering your tracking code googleAnalytics = "" +# number of words of summarized post content (default 70) +summaryLength = 70 # Define the number of posts per page paginate = 10 diff --git a/exampleSite/content/blog/hugo-is-for-lovers.md b/exampleSite/content/blog/hugo-is-for-lovers.md index 64d6b45..bc7ea42 100644 --- a/exampleSite/content/blog/hugo-is-for-lovers.md +++ b/exampleSite/content/blog/hugo-is-for-lovers.md @@ -4,6 +4,7 @@ date = "2015-08-03T13:39:46+02:00" tags = ["hugo"] categories = ["pseudo"] banner = "img/banners/banner-3.jpg" +summary="This is the summary Goto [hugo releases](https://github.com/spf13/hugo/releases) and download the appropriate version for your os and architecture. Save it somewhere specific as we will be using it in the next step. More complete instructions are available at [installing hugo](/overview/installing/)" +++ ## Step 1. Install Hugo -- cgit v1.2.3