From a998fdc6e8380091a8ae1c270e153e0f2e8c44e2 Mon Sep 17 00:00:00 2001 From: Ghyslain Leclerc Date: Sat, 27 Oct 2018 16:29:28 -0400 Subject: Adding capacity to summarize microposts as well. --- README.md | 75 +++++++++++++++++---------------- layouts/microposts/single.html | 5 ++- layouts/partials/preview_micropost.html | 37 +++++++++++++++- 3 files changed, 77 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index e04993e..cac8f07 100644 --- a/README.md +++ b/README.md @@ -73,17 +73,17 @@ You can control which menu items get an RSS icon and link by adding the `RSSSect ``` [params] - RSSSections = [ "Posts", "Microposts", "Photos" ] + RSSSections = [ "Posts", "Microposts", "Photos" ] ``` You can then control the name and weight of these menus in your `config.toml` by adding a section for each menu item you'd like to display: ``` [[menu.main]] - name = "Posts" - weight = 1 - identifier = "posts" - url = "/posts/" + name = "Posts" + weight = 1 + identifier = "posts" + url = "/posts/" ``` If you aren't sure of how this should look, see how [jnjosh.com uses this in it's config.toml](https://github.com/jnjosh/jnjosh.com/blob/master/config.toml). @@ -99,12 +99,12 @@ It looks like most themes use the `author` variable to add something simple like ``` [author] - Handle = "" - FirstName = "" - LastName = "" - AboutPage = "" - Location = "" - FlickrID = "" + Handle = "" + FirstName = "" + LastName = "" + AboutPage = "" + Location = "" + FlickrID = "" ``` **Recommendation:** Don't use the `author` variable, use the above `[author]` section in your `config.toml`. @@ -147,7 +147,8 @@ These posts are rendered slightly different with an → to signify that it is re | `[params]` - `RSSEnabled` | `true` or `false` | No. If true, RSS pages will be generated. | | `[params]` - `RSSSections` | `[ "Posts", "Microposts", "Photos" ]` | If you want RSS links in the menu, yes. These strings need to be the display name of the section where you want to have an RSS icon displayed. ![rss](https://github.com/jnjosh/internet-weblog/blob/master/images/rss.png) | | `[params]` - `RSSMicropostTitles` | `true` or `false` | No. If false, Microposts RSS feeds will not have the title in included posts. If not present or true, nothing happens. | -| `[params]` - `YearlyMicroposts` | `true` or `false` | No. If true, Microposts will have a page with a yearly grouping just like the posts. If not present or false, nothing happens. | +| `[params]` - `YearlyMicroposts` | `true` or `false` | No. If true, Microposts will have a page with a yearly grouping just like the posts. If not present or false, the default of not having a micropost yearly grouping is applied. | +| `[params]` - `SummarizeMicroposts` | `true` or `false` | No. If true, Microposts will have a page with a yearly grouping just like the posts. If not present or false, the default of not summarizing micropost is applied. | Here is an example `config.toml`: @@ -160,41 +161,41 @@ Paginate = 10 SectionPagesMenu = "main" [author] - Handle = "jnjosh" - FirstName = "Josh" - LastName = "Johnson" - AboutPage = "/about" - Location = "Durham, NC" - FlickrID = "87151163@N00" + Handle = "jnjosh" + FirstName = "Josh" + LastName = "Johnson" + AboutPage = "/about" + Location = "Durham, NC" + FlickrID = "87151163@N00" [params] - Description = "This is my blog, read it and enjoy." - ShowCopyright = true - RSSEnabled = true - RSSSections = [ "Posts", "Microposts", "Photos" ] + Description = "This is my blog, read it and enjoy." + ShowCopyright = true + RSSEnabled = true + RSSSections = [ "Posts", "Microposts", "Photos" ] [taxonomies] - tag = "tags" - category = "categories" - series = "series" + tag = "tags" + category = "categories" + series = "series" [[menu.main]] - name = "Posts" - weight = 1 - identifier = "posts" - url = "/posts/" + name = "Posts" + weight = 1 + identifier = "posts" + url = "/posts/" [[menu.main]] - name = "Microposts" - weight = 2 - identifier = "microposts" - url = "/microposts/" + name = "Microposts" + weight = 2 + identifier = "microposts" + url = "/microposts/" [[menu.main]] - name = "Photos" - weight = 3 - identifier = "photos" - url = "/photos/" + name = "Photos" + weight = 3 + identifier = "photos" + url = "/photos/" ``` ### Overrides diff --git a/layouts/microposts/single.html b/layouts/microposts/single.html index a2be260..b051d7d 100644 --- a/layouts/microposts/single.html +++ b/layouts/microposts/single.html @@ -2,7 +2,10 @@ {{ partial "page_header.html" . }}
- {{ partial "preview_micropost.html" . }} +
{{ partial "page_footer.html" . }} diff --git a/layouts/partials/preview_micropost.html b/layouts/partials/preview_micropost.html index e622cc1..b0c42f5 100644 --- a/layouts/partials/preview_micropost.html +++ b/layouts/partials/preview_micropost.html @@ -1,4 +1,37 @@
- {{ .Content }} - + {{ if isset .Site.Params "summarizemicroposts" | and ( eq .Site.Params.summarizemicroposts true ) }} + {{ if (not (isset .Params "externalurl")) }} +

{{ .Title }}

+ {{ else }} +

→ {{ .Title }}

+ {{ end }} + + + +

+ {{ if or (not (isset .Params "externalurl")) }} + {{ .Summary }} + {{ else }} + {{ .Content }} + {{ end }} +

+ + {{ if .Truncated }} + {{ if (not (isset .Params "externalurl")) }} + Continue Reading » + {{ end }} + {{ end }} + {{ else }} + {{ .Content }} + + {{ end }}
-- cgit v1.2.3 From d0cac652ad163a483c1bdc58360fe49e5224b551 Mon Sep 17 00:00:00 2001 From: Ghyslain Leclerc Date: Thu, 15 Nov 2018 10:38:54 -0500 Subject: Documentation correction for micropost summarize. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cac8f07..8fcf1b4 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ These posts are rendered slightly different with an → to signify that it is re | `[params]` - `RSSSections` | `[ "Posts", "Microposts", "Photos" ]` | If you want RSS links in the menu, yes. These strings need to be the display name of the section where you want to have an RSS icon displayed. ![rss](https://github.com/jnjosh/internet-weblog/blob/master/images/rss.png) | | `[params]` - `RSSMicropostTitles` | `true` or `false` | No. If false, Microposts RSS feeds will not have the title in included posts. If not present or true, nothing happens. | | `[params]` - `YearlyMicroposts` | `true` or `false` | No. If true, Microposts will have a page with a yearly grouping just like the posts. If not present or false, the default of not having a micropost yearly grouping is applied. | -| `[params]` - `SummarizeMicroposts` | `true` or `false` | No. If true, Microposts will have a page with a yearly grouping just like the posts. If not present or false, the default of not summarizing micropost is applied. | +| `[params]` - `SummarizeMicroposts` | `true` or `false` | No. If true, Microposts will be summarized in the main list just like posts with a continue reading link. If not present or false, the default of not summarizing microposts is applied. | Here is an example `config.toml`: -- cgit v1.2.3