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

github.com/mismith0227/hugo_theme_pickles.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Engel <vlow+git@turbocache3000.de>2021-09-18 21:50:41 +0300
committerFlorian Engel <vlow+git@turbocache3000.de>2021-09-18 21:50:41 +0300
commit467ba19589542db906157cacc68683bc9a8300ad (patch)
tree24a47945e21c0cd3b247f9328f21a79b2b40668f
parent323d292018e05a6e25723372d563961ae7829606 (diff)
Adjust architecture to match changes
Since the date can be hidden, this commit also inverts the logic for word-count and reading-time. It also adjusts the css class name, since the same class is now used for all metadata in the post header.
-rwxr-xr-xexampleSite/config.toml8
-rwxr-xr-xlayouts/_default/li.html7
-rwxr-xr-xlayouts/_default/single.html17
-rw-r--r--layouts/partials/post_metadata.html12
-rw-r--r--layouts/partials/reading_time.html7
-rw-r--r--layouts/partials/word_count.html1
-rw-r--r--src/scss/object/component/meta.scss (renamed from src/scss/object/component/time.scss)2
-rw-r--r--src/scss/style.scss2
8 files changed, 34 insertions, 22 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index bc88960..3f41391 100755
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -9,8 +9,12 @@ googleAnalytics = "Your Google Analytics tracking id"
[params]
paginate = 10
- wordCount = true
- readingTime = true
+ # Hide the date on posts
+ # hideDate = true
+ # Hide the word count on posts and in the posts list
+ # hideWordCount = true
+ # Hide the reading time on posts and in the posts list
+ # hideReadingTime = true
custom_css = ["/css/custom.css"]
# Social accounts. Link to these accounts are displayed in the header and
# footer
diff --git a/layouts/_default/li.html b/layouts/_default/li.html
index d470649..7e3c953 100755
--- a/layouts/_default/li.html
+++ b/layouts/_default/li.html
@@ -3,7 +3,12 @@
<h2 class="c-title c-article__title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<p class="c-article__meta">
{{ partial "timestamp.html" . }}
- {{ partial "post_metadata.html" . }}
+ {{ if not (.Param "hideWordCount") }}
+ | {{ partial "word_count.html" . }}
+ {{ end }}
+ {{ if not (.Param "hideReadingTime") }}
+ | {{ partial "reading_time.html" . }}
+ {{ end }}
</p>
</header>
<div class="c-article__summary">
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 05cd9ec..9000d8b 100755
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -5,12 +5,19 @@
<h1>{{ .Title }}</h1>
{{ if eq (.Type | singularize) "post" }}
<div>
- {{ if not .Params.hideDate }}
- <div class="c-time">
- {{ partial "timestamp.html" . }}
+ <div class="c-meta">
+ {{ if not (.Param "hideDate") }}
+ {{ partial "timestamp.html" . }}
+ {{ end }}
+ {{ if not (.Param "hideWordCount") }}
+ {{ if not (.Param "hideDate") }} | {{ end }}
+ {{ partial "word_count.html" . }}
+ {{ end }}
+ {{ if not (.Param "hideReadingTime") }}
+ {{ if not (and (.Param "hideDate") (.Param "hideWordCount")) }} | {{ end }}
+ {{ partial "reading_time.html" . }}
+ {{ end }}
</div>
- {{ end }}
- {{ partial "post_metadata.html" . }}
</div>
{{ range .Params.tags }}
<a href="{{ $baseurl }}/tags/{{ . | urlize }}" class="c-tag">{{ . }}</a>
diff --git a/layouts/partials/post_metadata.html b/layouts/partials/post_metadata.html
deleted file mode 100644
index b14c162..0000000
--- a/layouts/partials/post_metadata.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{{ if .Param "wordCount" }}
-| {{ .WordCount }} words
-{{ end }}
-{{ if .Param "readingTime" }}
- {{ if gt .ReadingTime 1 }}
- {{ .Scratch.Set "readingTime" "mins" }}
- {{ else }}
- {{ .Scratch.Set "readingTime" "min" }}
- {{ end }}
- | ~{{.ReadingTime}} {{ .Scratch.Get "readingTime" }}
-{{ end }}
-
diff --git a/layouts/partials/reading_time.html b/layouts/partials/reading_time.html
new file mode 100644
index 0000000..cbb7a75
--- /dev/null
+++ b/layouts/partials/reading_time.html
@@ -0,0 +1,7 @@
+{{ if gt .ReadingTime 1 }}
+{{ .Scratch.Set "readingTime" "mins" }}
+{{ else }}
+{{ .Scratch.Set "readingTime" "min" }}
+{{ end }}
+~{{.ReadingTime}} {{ .Scratch.Get "readingTime" }}
+
diff --git a/layouts/partials/word_count.html b/layouts/partials/word_count.html
new file mode 100644
index 0000000..de29183
--- /dev/null
+++ b/layouts/partials/word_count.html
@@ -0,0 +1 @@
+{{ .WordCount }} words
diff --git a/src/scss/object/component/time.scss b/src/scss/object/component/meta.scss
index 3991c52..5c561e9 100644
--- a/src/scss/object/component/time.scss
+++ b/src/scss/object/component/meta.scss
@@ -1,4 +1,4 @@
-.c-time {
+.c-meta {
display: block;
font-size: 1.6rem;
}
diff --git a/src/scss/style.scss b/src/scss/style.scss
index 516213c..03dd905 100644
--- a/src/scss/style.scss
+++ b/src/scss/style.scss
@@ -16,7 +16,7 @@
@use 'object/component/links';
@use 'object/component/article';
@use 'object/component/avatar';
-@use 'object/component/time';
+@use 'object/component/meta';
@use 'object/component/tag';
@use 'object/component/pagination';