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

github.com/zwbetz-gh/minimal-bootstrap-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Betz <zwbetz@gmail.com>2018-12-06 08:41:08 +0300
committerZachary Betz <zwbetz@gmail.com>2018-12-06 08:41:08 +0300
commit372ee6b37d8bbbe19abc2c8bc36709b4889fc2ed (patch)
tree553098ec12037286b87930bf28dd82939b053e7c /layouts
parent74322e9842342f0610e004cd4d7b5414bc54cde4 (diff)
Add support for tags
Diffstat (limited to 'layouts')
-rw-r--r--layouts/404.html0
-rw-r--r--layouts/index.html14
-rw-r--r--layouts/partials/post-list.html16
-rw-r--r--layouts/post/single.html15
-rw-r--r--layouts/taxonomy/taxonomy.html7
-rw-r--r--layouts/taxonomy/terms.html14
6 files changed, 48 insertions, 18 deletions
diff --git a/layouts/404.html b/layouts/404.html
deleted file mode 100644
index e69de29..0000000
--- a/layouts/404.html
+++ /dev/null
diff --git a/layouts/index.html b/layouts/index.html
index 4254c90..7043173 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -3,18 +3,6 @@
{{ $homepage := "" }}{{ range first 1 .Site.Menus.nav }}{{ $homepage = .Name }}{{ end }}
<h1>{{ $homepage }}</h1>
-{{ range where .Pages.ByPublishDate.Reverse "Section" "post" }}
- <p>
- <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
- {{ $customDateFormat := "January 2, 2006" }}
- {{ with .Site.Params.customDateFormat }}{{ $customDateFormat = . }}{{ end }}
- <br>
- <small class="text-secondary">{{ .PublishDate.Format $customDateFormat }}</small>
- {{ if eq .Site.Params.showPostSummary true }}
- <br>
- {{ .Summary }}
- {{ end }}
- </p>
-{{ end }}
+{{ partial "post-list" . }}
{{- end -}} \ No newline at end of file
diff --git a/layouts/partials/post-list.html b/layouts/partials/post-list.html
new file mode 100644
index 0000000..9a8b0a3
--- /dev/null
+++ b/layouts/partials/post-list.html
@@ -0,0 +1,16 @@
+{{ range where .Pages.ByPublishDate.Reverse "Section" "post" }}
+ <p>
+ <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
+ {{ $customDateFormat := "January 2, 2006" }}
+ {{ with .Site.Params.customDateFormat }}{{ $customDateFormat = . }}{{ end }}
+ <br>
+ <small class="text-secondary">{{ .PublishDate.Format $customDateFormat }}</small>
+ {{ range .Params.tags }}
+ <small><code><a href="{{ "/tags/" | absURL }}{{ . | urlize }}">{{ . }}</a></code></small>
+ {{ end }}
+ {{ if eq .Site.Params.showPostSummary true }}
+ <br>
+ {{ .Summary }}
+ {{ end }}
+ </p>
+{{ end }} \ No newline at end of file
diff --git a/layouts/post/single.html b/layouts/post/single.html
index 9e70fe5..933925f 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -1,11 +1,16 @@
{{- define "main" -}}
<h1>{{ .Title | markdownify }}</h1>
-<p><small class="text-secondary">
-{{ $customDateFormat := "January 2, 2006" }}
-{{ with .Site.Params.customDateFormat }}{{ $customDateFormat = . }}{{ end }}
-{{ .PublishDate.Format $customDateFormat }}{{ if gt .Lastmod .PublishDate }}, updated {{ .Lastmod.Format $customDateFormat }}{{ end }}
-</small></p>
+<p>
+ <small class="text-secondary">
+ {{ $customDateFormat := "January 2, 2006" }}
+ {{ with .Site.Params.customDateFormat }}{{ $customDateFormat = . }}{{ end }}
+ {{ .PublishDate.Format $customDateFormat }}{{ if gt .Lastmod .PublishDate }}, updated {{ .Lastmod.Format $customDateFormat }}{{ end }}
+ </small>
+ {{ range .Params.tags }}
+ <small><code><a href="{{ "/tags/" | absURL }}{{ . | urlize }}">{{ . }}</a></code></small>
+ {{ end }}
+</p>
{{ .Content }}
{{- end -}} \ No newline at end of file
diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html
new file mode 100644
index 0000000..5a0de4d
--- /dev/null
+++ b/layouts/taxonomy/taxonomy.html
@@ -0,0 +1,7 @@
+{{- define "main" -}}
+
+<h1>{{ .Title }}</h1>
+
+{{ partial "post-list" . }}
+
+{{- end -}} \ No newline at end of file
diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html
new file mode 100644
index 0000000..8216a5d
--- /dev/null
+++ b/layouts/taxonomy/terms.html
@@ -0,0 +1,14 @@
+{{- define "main" -}}
+
+<h1>{{ .Title }}</h1>
+
+{{ $type := .Type }}
+{{ range $key, $value := .Data.Terms.ByCount }}
+ {{ $name := .Name }}
+ {{ $count := .Count }}
+ {{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
+ <p><a href="{{ .Permalink }}"><code>{{ $name }}</code></a> {{ $count }}</p>
+ {{ end }}
+{{ end }}
+
+{{- end -}} \ No newline at end of file