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

github.com/ribice/kiss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmir Ribić <ribice@gmail.com>2020-03-04 23:27:08 +0300
committerGitHub <noreply@github.com>2020-03-04 23:27:08 +0300
commit846efa80dd289bfa5e88ff83d6fbee166633958d (patch)
tree0aef50962e68415c157f5b3663e5c940b0cf5026
parent6e4d72a35035cee6bef6d5561204f99603bcbaaf (diff)
parentd60bb782a5ddd48dd88a0c9276645e2a5ff1d606 (diff)
Merge pull request #86 from mogimogitomato/feature/add_taxonomies_counter
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 f9a1432..6e26e05 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 fd66661..178b63e 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -23,6 +23,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/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