Merge pull request #10 from ghlecl/master

Adding capacity to summarize microposts as well.
This commit is contained in:
Josh Johnson 2018-11-16 12:16:19 -05:00 committed by GitHub
commit 1f72de06f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 40 deletions

View file

@ -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 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`:

View file

@ -2,7 +2,10 @@
{{ partial "page_header.html" . }}
<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>
{{ partial "page_footer.html" . }}

View file

@ -1,4 +1,37 @@
<article class="micropost">
{{ if isset .Site.Params "summarizemicroposts" | and ( eq .Site.Params.summarizemicroposts true ) }}
{{ 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>