Feat: add repost feature (#156)

This commit is contained in:
Cell
2022-07-10 18:21:35 +08:00
parent 38314a5d0f
commit 35d54b22cb
29 changed files with 102 additions and 12 deletions
+1 -3
View File
@@ -41,9 +41,7 @@
<h2 class="group-title">{{ .Key }}</h2>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
</span>
+8
View File
@@ -19,6 +19,14 @@
{{- /* Title */ -}}
<h1 class="single-title" itemprop="name headline">
{{ $repost := $params.repost | default dict }}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "repost") .Url ) (T "repost") -}}
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>