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

github.com/mdashx/basicwebtheme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortom <tom@mdashx.com>2020-12-06 23:38:32 +0300
committertom <tom@mdashx.com>2020-12-06 23:38:32 +0300
commit3686bc63b6e29d24b8ef4ab5e4a8a65b3ea46ae5 (patch)
tree6afb76ec36a8ba90dc894a9ac67665dbba9a64e8
parentaddbe1d00d5abcffb446a28f858162c652c7147b (diff)
Option to show date, new permalink style
-rw-r--r--layouts/_default/list.html5
-rw-r--r--layouts/partials/post-preview.html19
2 files changed, 16 insertions, 8 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 1d0fba8..e365ff9 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -2,9 +2,12 @@
{{ .Content }}
+{{ $bigtitle := .Param "bigtitle" }}
+{{ $showdate := .Param "showdate" }}
+
{{ range .Pages }}
-{{ partial "post-preview.html" (dict "page" . "full" true "bigtitle" (.Param "bigtitle") ) }}
+{{ partial "post-preview.html" (dict "page" . "full" true "bigtitle" $bigtitle "showdate" $showdate) }}
{{ end }}
diff --git a/layouts/partials/post-preview.html b/layouts/partials/post-preview.html
index 9a433aa..9b6d83b 100644
--- a/layouts/partials/post-preview.html
+++ b/layouts/partials/post-preview.html
@@ -1,25 +1,28 @@
{{ $full := false }}
-{{ $bigTitle := true }}
+{{ $bigtitle := true }}
{{ $content := .page.Content }}
+{{ $showdate := false }}
{{ if isset . "full" }}{{ $full = .full }}{{ end }}
-{{ if isset . "bigtitle" }}{{ $bigTitle = .bigtitle }}{{ end }}
+{{ if isset . "bigtitle" }}{{ $bigtitle = .bigtitle }}{{ end }}
+{{ if isset . "showdate" }}{{ $showdate = .showdate }}{{ end }}
{{ if not $full}}
{{ $content = $content | truncate 200}}
{{ end }}
-{{ if $bigTitle }}
+{{ if $bigtitle }}
<div class="post-header">
<div class="post-title">
- {{ if .page.PublishDate }}
+ {{ if (and .page.PublishDate $showdate)}}
<h2>{{ .page.Title }}</h2>
<a href={{ .page.Permalink }}>
<em>{{ .page.PublishDate.Format "January 2, 2006" }}</em>
</a>
{{ else }}
+ <h2>{{ .page.Title }}</h2>
<a href={{ .page.Permalink }}>
- <h2>{{ .page.Title }}</h2>
+ <em><span style="font-size: smaller;">{{ .page.RelPermalink }}</span></em>
</a>
{{ end }}
</div>
@@ -27,15 +30,17 @@
{{ else }}
<div class="post-header">
<div class="post-title">
- {{ if .page.PublishDate }}
+ {{ if eq (and .page.PublishDate $showdate) true}}
<em>{{ .page.Title }}</em><span> - </span>
<a href={{ .page.Permalink }}>
<em>{{ .page.PublishDate.Format "January 2, 2006" }}</em>
</a>
{{ else }}
+ <em>{{ .page.Title }}</em><span> - </span>
+
<a href={{ .page.Permalink }}>
- <em>{{ .page.Title }}</em>
+ <em><span style="font-size: smaller;">{{ .page.RelPermalink }}</span></em>
</a>
{{ end }}
</div>