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

github.com/pavel-pi/kiss-em.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormogimogitomato <osakana.yano49@gmail.com>2019-12-14 19:42:28 +0300
committermogimogitomato <osakana.yano49@gmail.com>2019-12-15 06:13:28 +0300
commitceacb8701ce3576802367960ce3c357c43d9b154 (patch)
tree30a702d7f41e97676300f97e8a962c4e78216e3c
parent329df0977b5e2a3519e048124d262d642eedb118 (diff)
add taxonomies counter
-rw-r--r--README.md1
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/partials/taxonomies_count.html13
4 files changed, 16 insertions, 1 deletions
diff --git a/README.md b/README.md
index 6e4d55e..3b2f3ef 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@ homeTitle = "" # Title for home page
poweredby = true # Adds powered by hugo and kiss below Copyright
related = true # Includes related articles at the bottom of the article
codeCopy = true # Add copy button above code blocks
+taxonomiesCount = true # Add taxonomies count
[params.features]
disqusOnDemand = true # Load Disqus comments on click
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index cf5546e..4d2d55b 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -27,6 +27,7 @@ enableSocial = false # Adds OpenGraph and Twitter cards
homeTitle = "" # Title for home page
poweredby = true # Adds powered by Hugo and Kiss below Copyright section
related = true # Includes related articles
+taxonomiesCount = true # Add taxonomies count
[params.opengraph.facebook]
admins = [] # array of Facebook IDs
diff --git a/layouts/index.html b/layouts/index.html
index 14da1f4..526534b 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -14,7 +14,7 @@
{{ end }}
</div>
<h2 class="subtitle is-6 date">{{ .Date.Format "January 2, 2006" }}</h2>
- <h1 class="title"><a href="{{ .Permalink }}">{{ .Title }}</a>{{ if .Draft }} ::Draft{{ end }}</h1>
+ <h1 class="title"><a href="{{ .Permalink }}">{{ .Title }}{{ partial "taxonomies_count" . }}</a>{{ if .Draft }} ::Draft{{ end }}</h1>
<div class="content">
{{ .Summary | plainify | safeHTML }}
{{ if .Truncated }}
diff --git a/layouts/partials/taxonomies_count.html b/layouts/partials/taxonomies_count.html
new file mode 100644
index 0000000..a17590d
--- /dev/null
+++ b/layouts/partials/taxonomies_count.html
@@ -0,0 +1,13 @@
+{{if .Site.Params.Info.taxonomiesCount}}
+{{ $title := urlize .Title }}
+ {{ range $taxonomy_name, $taxonomy := .Site.Taxonomies }}
+ {{ if eq $.Section $taxonomy_name}}
+ {{ range $key, $value := $taxonomy }}
+ {{ $term := urlize $key }}
+ {{ if eq $title $term }}
+ ({{ $value.Count }})
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+{{ end }} \ No newline at end of file