Merge pull request #7 from ghlecl/master

Add capacity to get yearly grouping for microposts.
This commit is contained in:
Josh Johnson 2018-01-19 13:53:24 -05:00 committed by GitHub
commit 6c2033d06b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 34 deletions

View file

@ -141,11 +141,12 @@ These posts are rendered slightly different with an → to signify that it is re
| `[author]` - `LastName` | Your last name | Not really. It is used in some places to identify you as the author. | | `[author]` - `LastName` | Your last name | Not really. It is used in some places to identify you as the author. |
| `[author]` - `AboutPage` | `/about` or `http://about.othersite.com` | Only if you want an about page. This is exposed to allow you to link to an external about page as well. If you have a local page it can just be something relative. | | `[author]` - `AboutPage` | `/about` or `http://about.othersite.com` | Only if you want an about page. This is exposed to allow you to link to an external about page as well. If you have a local page it can just be something relative. |
| `[author]` - `Location` | `Your City` | No. If set, this is added to the Copyright in the footer so you can give some love to your hometown. | | `[author]` - `Location` | `Your City` | No. If set, this is added to the Copyright in the footer so you can give some love to your hometown. |
| `[author]` - `FlickrID` | `Your Flickr ID` | Kind of. The footer shows your photo stream from flickr. If you don't set it you'll see random photos that Flickr serves you. | | `[author]` - `FlickrID` | `Your Flickr ID` | No. The footer shows your photo stream from flickr. If you don't set it, nothing will be displayed. |
| `[params]` - `Description` | `Describe your site` | No. If set this is added to your pages metadata. | | `[params]` - `Description` | `Describe your site` | No. If set, this is added to your pages metadata. |
| `[params]` - `ShowCopyright` | `true` or `false` | No. If true, Copyright text will be added to the footer. | | `[params]` - `ShowCopyright` | `true` or `false` | No. If true, Copyright text will be added to the footer. |
| `[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]` - `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. |
Here is an example `config.toml`: Here is an example `config.toml`:

View file

@ -1,9 +1,7 @@
{{ partial "site_header.html" . }} {{ partial "site_header.html" . }}
{{ partial "page_header.html" . }} {{ partial "page_header.html" . }}
<main class="content list"> {{ partial "default_list.html" . }}
{{ partial "preview_list.html" . }}
</main>
{{ partial "page_footer.html" . }} {{ partial "page_footer.html" . }}
{{ partial "site_footer.html" . }} {{ partial "site_footer.html" . }}

View file

@ -0,0 +1,3 @@
<main class="content list">
{{ partial "preview_list.html" . }}
</main>

View file

@ -0,0 +1,25 @@
<main class="content">
<article class="post-groups">
<div class="post-group">
{{ range .Data.Pages.GroupByDate "2006" }}
<div class="post-group-item">
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<li>
{{ if (not (isset .Params "externalurl")) }}
<a rel="full-article" href="{{ .Permalink }}">{{ .Title }}</a>
on <time datetime="{{ .Date }}" pubdate="">{{ .Date.Format "January 2" }}</time>
{{ else }}
<a rel="remote-article" href="{{ .Params.externalurl }}">{{ .Title }} →</a>
on
<a href="{{ .Permalink }}"> <time datetime="{{ .Date }}" pubdate="">{{ .Date.Format "January 2" }}</time> </a>
{{ end }}
</li>
{{ end }}
</ul>
</div>
{{ end }}
</div>
</article>
</main>

View file

@ -0,0 +1,15 @@
{{ partial "site_header.html" . }}
{{ partial "page_header.html" . }}
{{ if isset .Site.Params "yearlymicroposts" | and ( .Site.Params.yearlymicroposts ) }}
{{ partial "yearly_grouping.html" . }}
{{ else }}
{{ partial "default_list.html" . }}
{{ end }}
{{ partial "page_footer.html" . }}
{{ partial "site_footer.html" . }}

View file

@ -1,31 +1,7 @@
{{ partial "site_header.html" . }} {{ partial "site_header.html" . }}
{{ partial "page_header.html" . }} {{ partial "page_header.html" . }}
<main class="content"> {{ partial "yearly_grouping.html" . }}
<article class="post-groups">
<div class="post-group">
{{ range .Data.Pages.GroupByDate "2006" }}
<div class="post-group-item">
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<li>
{{ if (not (isset .Params "externalurl")) }}
<a rel="full-article" href="{{ .Permalink }}">{{ .Title }}</a>
on <time datetime="{{ .Date }}" pubdate="">{{ .Date.Format "January 2" }}</time>
{{ else }}
<a rel="remote-article" href="{{ .Params.externalurl }}">{{ .Title }} →</a>
on
<a href="{{ .Permalink }}"><time datetime="{{ .Date }}" pubdate="">{{ .Date.Format "January 2" }}</time></a>
{{ end }}
</li>
{{ end }}
</ul>
</div>
{{ end }}
</div>
</article>
</main>
{{ partial "page_footer.html" . }} {{ partial "page_footer.html" . }}
{{ partial "site_footer.html" . }} {{ partial "site_footer.html" . }}