Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jnjosh/internet-weblog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhyslain Leclerc <ghleclerc@gmail.com>2017-11-30 00:50:45 +0300
committerGhyslain Leclerc <ghleclerc@gmail.com>2017-11-30 01:05:06 +0300
commit03642a1bc36f0ffa86e6a04f77539b8dbb9a3335 (patch)
treed0ca25b75d561faf3091f896d90d397424d6ef09
parent0edc6541d0ebc8a52fa4e673e1cee4b634b4efc3 (diff)
Add capacity to get yearly grouping for microposts.
Adds a parameter called YearlyMicroposts which is used to either: - output the usual list of microposts if the parameter is not set or set to false; - output a list of micropost titles grouped by year (just like the posts list is) if the parameter is set and true. The default behavior is not changed and the setting needs not be defined thus not complicating the default installation.
-rw-r--r--layouts/_default/list.html4
-rw-r--r--layouts/partials/default_list.html3
-rw-r--r--layouts/partials/yearly_grouping.html25
-rw-r--r--layouts/section/microposts.html15
-rw-r--r--layouts/section/posts.html26
5 files changed, 45 insertions, 28 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 20ca950..2e128cf 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,9 +1,7 @@
{{ partial "site_header.html" . }}
{{ partial "page_header.html" . }}
- <main class="content">
- {{ partial "preview_list.html" . }}
- </main>
+{{ partial "default_list.html" . }}
{{ partial "page_footer.html" . }}
{{ partial "site_footer.html" . }}
diff --git a/layouts/partials/default_list.html b/layouts/partials/default_list.html
new file mode 100644
index 0000000..142274c
--- /dev/null
+++ b/layouts/partials/default_list.html
@@ -0,0 +1,3 @@
+<main class="content">
+ {{ partial "preview_list.html" . }}
+</main>
diff --git a/layouts/partials/yearly_grouping.html b/layouts/partials/yearly_grouping.html
new file mode 100644
index 0000000..0cccf9e
--- /dev/null
+++ b/layouts/partials/yearly_grouping.html
@@ -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>
diff --git a/layouts/section/microposts.html b/layouts/section/microposts.html
new file mode 100644
index 0000000..c825505
--- /dev/null
+++ b/layouts/section/microposts.html
@@ -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" . }} \ No newline at end of file
diff --git a/layouts/section/posts.html b/layouts/section/posts.html
index aca6cfa..24510ab 100644
--- a/layouts/section/posts.html
+++ b/layouts/section/posts.html
@@ -1,31 +1,7 @@
{{ partial "site_header.html" . }}
{{ partial "page_header.html" . }}
- <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>
+{{ partial "yearly_grouping.html" . }}
{{ partial "page_footer.html" . }}
{{ partial "site_footer.html" . }}