Adding capacity to summarize microposts as well.

This commit is contained in:
Ghyslain Leclerc 2018-10-27 16:29:28 -04:00
parent 0c39cde248
commit a998fdc6e8
3 changed files with 77 additions and 40 deletions

View file

@ -73,17 +73,17 @@ You can control which menu items get an RSS icon and link by adding the `RSSSect
``` ```
[params] [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: 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]] [[menu.main]]
name = "Posts" name = "Posts"
weight = 1 weight = 1
identifier = "posts" identifier = "posts"
url = "/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). 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] [author]
Handle = "<Your `handle`>" Handle = "<Your `handle`>"
FirstName = "<Your First Name>" FirstName = "<Your First Name>"
LastName = "<Your Last Name>" LastName = "<Your Last Name>"
AboutPage = "<The relative or complete link to your about page>" AboutPage = "<The relative or complete link to your about page>"
Location = "<Your Location>" Location = "<Your Location>"
FlickrID = "<Your Flickr ID>" FlickrID = "<Your Flickr ID>"
``` ```
**Recommendation:** Don't use the `author` variable, use the above `[author]` section in your `config.toml`. **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]` - `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]` - `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]` - `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`: Here is an example `config.toml`:
@ -160,41 +161,41 @@ Paginate = 10
SectionPagesMenu = "main" SectionPagesMenu = "main"
[author] [author]
Handle = "jnjosh" Handle = "jnjosh"
FirstName = "Josh" FirstName = "Josh"
LastName = "Johnson" LastName = "Johnson"
AboutPage = "/about" AboutPage = "/about"
Location = "Durham, NC" Location = "Durham, NC"
FlickrID = "87151163@N00" FlickrID = "87151163@N00"
[params] [params]
Description = "This is my blog, read it and enjoy." Description = "This is my blog, read it and enjoy."
ShowCopyright = true ShowCopyright = true
RSSEnabled = true RSSEnabled = true
RSSSections = [ "Posts", "Microposts", "Photos" ] RSSSections = [ "Posts", "Microposts", "Photos" ]
[taxonomies] [taxonomies]
tag = "tags" tag = "tags"
category = "categories" category = "categories"
series = "series" series = "series"
[[menu.main]] [[menu.main]]
name = "Posts" name = "Posts"
weight = 1 weight = 1
identifier = "posts" identifier = "posts"
url = "/posts/" url = "/posts/"
[[menu.main]] [[menu.main]]
name = "Microposts" name = "Microposts"
weight = 2 weight = 2
identifier = "microposts" identifier = "microposts"
url = "/microposts/" url = "/microposts/"
[[menu.main]] [[menu.main]]
name = "Photos" name = "Photos"
weight = 3 weight = 3
identifier = "photos" identifier = "photos"
url = "/photos/" url = "/photos/"
``` ```
### Overrides ### Overrides

View file

@ -2,7 +2,10 @@
{{ partial "page_header.html" . }} {{ partial "page_header.html" . }}
<main class="content"> <main class="content">
{{ partial "preview_micropost.html" . }} <article class="micropost">
{{ .Content }}
<a href='{{ .Permalink }}'><aside class="dates">→ {{ .Date.Format "2006/01/02 3:04 PM" }}</aside></a>
</article>
</main> </main>
{{ partial "page_footer.html" . }} {{ partial "page_footer.html" . }}

View file

@ -1,4 +1,37 @@
<article class="micropost"> <article class="micropost">
{{ .Content }} {{ if isset .Site.Params "summarizemicroposts" | and ( eq .Site.Params.summarizemicroposts true ) }}
<a href='{{ .Permalink }}'><aside class="dates">→ {{ .Date.Format "2006/01/02 3:04 PM" }}</aside></a> {{ if (not (isset .Params "externalurl")) }}
<h2><a rel="full-article" href="{{ .Permalink }}">{{ .Title }}</a></h2>
{{ else }}
<h2><a rel="remote-article" href="{{ .Params.externalurl }}">→ {{ .Title }}</a> <a href="{{ .Permalink }}"></a></h2>
{{ end }}
<div class="postmeta">Posted on <time datetime="{{ .Date }}" pubdate="">{{ .Date.Format "January 2, 2006" }}</time>
{{ if (isset .Params "categories") }}
in
<span class="categories">
{{ range $i, $v := .Params.categories }}
<a class="category" href="/categories/{{ $v | urlize }}">{{ $v }}</a>{{ if ne (len $.Params.categories) (add $i 1) }}, {{ end }}
{{ end }}
</span>
{{ end }}
</div>
<p>
{{ if or (not (isset .Params "externalurl")) }}
{{ .Summary }}
{{ else }}
{{ .Content }}
{{ end }}
</p>
{{ if .Truncated }}
{{ if (not (isset .Params "externalurl")) }}
<a class="continue" rel="full-article" href="{{ .Permalink }}">Continue Reading »</a>
{{ end }}
{{ end }}
{{ else }}
{{ .Content }}
<a href='{{ .Permalink }}'><aside class="dates">→ {{ .Date.Format "2006/01/02 3:04 PM" }}</aside></a>
{{ end }}
</article> </article>