Feat: add collection info at post meta

This commit is contained in:
Cell
2023-12-06 20:50:12 +08:00
parent c7a03ea847
commit 5d16e1ac0f
16 changed files with 106 additions and 36 deletions
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Teilen auf"
contents= "Inhalt"
repost= ""
publishedOnDate= "veröffentlicht an {{ .Date }}"
includedInCategories= "enthalten in {{ .Categories }}"
views = "Aufrufe"
comments = "Kommentare"
author = "Autor"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Passwort"
encryptyAgain = ""
[single.includedIn]
categories = "enthalten in {{ .Categories }}"
collections = "enthalten in {{ .Collections }}"
both = "enthalten in {{ .Categories }} und {{ .Collections }}"
[single.wordCount]
one = "Ein Wort"
other = "{{ .Count }} Wörter"
+5 -1
View File
@@ -105,7 +105,6 @@ other = "Share on"
contents = "Contents"
repost = "Repost"
publishedOnDate = "published on {{ .Date }}"
includedInCategories = "included in {{ .Categories }}"
views = "views"
comments = "comments"
author = "Author"
@@ -121,6 +120,11 @@ encryptedMessage = "Please enter the password"
password = "Password"
encryptyAgain = "Encrypt again"
[single.includedIn]
categories = "included in {{ .Categories }}"
collections = "included in {{ .Collections }}"
both = "included in {{ .Categories }} and {{ .Collections }}"
[single.wordCount]
one = "One word"
other = "{{ .Count }} words"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Compartir en"
contents= "Contenido"
repost= ""
publishedOnDate= "publicado el {{ .Date }}"
includedInCategories= "incluido en {{ .Categories }}"
views = "vistas"
comments = "Comentarios"
author = "Autor"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Contraseña"
encryptyAgain = ""
[single.includedIn]
categories = "incluido en {{ .Categories }}"
collections = "incluido en {{ .Collections }}"
both = "incluido en {{ .Categories }} y {{ .Collections }}"
[single.wordCount]
one = "Una palabra"
other = "{{ .Count }} palabras"
+5 -1
View File
@@ -105,7 +105,6 @@ other = "Partager via"
contents= "Contenus"
repost= "Reposter"
publishedOnDate= "publié le {{ .Date }}"
includedInCategories= "inclus dans {{ .Categories }}"
views = "vues"
comments = "commentaires"
author = "Auteur"
@@ -121,6 +120,11 @@ encryptedMessage = "Entrer le mot de passe"
password = "Mot de passe"
encryptyAgain = "Chiffrer à nouveau"
[single.includedIn]
categories = "inclus dans {{ .Categories }}"
collections = "inclus dans {{ .Collections }}"
both = "inclus dans {{ .Categories }} et {{ .Collections }}"
[single.wordCount]
one = "1 mot"
other = "{{ .Count }} mots"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Condividi su"
contents= "Contenuti"
repost= ""
publishedOnDate= "pubblicato su {{ .Date }}"
includedInCategories= "incluso in {{ .Categories }}"
views = "visualizzazioni"
comments = "commenti"
author = "Autore"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Password"
encryptyAgain = ""
[single.includedIn]
categories = "incluso in {{ .Categories }}"
collections = "incluso in {{ .Collections }}"
both = "incluso in {{ .Categories }} e {{ .Collections }}"
[single.wordCount]
one = "Una parola"
other = "{{ .Count }} parole"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Udostępnij na"
contents= "Spis treści"
repost= ""
publishedOnDate= "opublikowano {{ .Date }}"
includedInCategories= "zawarty w {{ .Categories }}"
views = "wyświetleń"
comments = "komentarzy"
author = "Autor"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Hasło"
encryptyAgain = ""
[single.includedIn]
categories = "zawarty w {{ .Categories }}"
collections = "zawarty w {{ .Collections }}"
both = "zawarty w {{ .Categories }} i {{ .Collections }}"
[single.wordCount]
one = "Jedno słowo"
other = "{{ .Count }} słów"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Compartilhe em"
contents= "Conteúdos"
repost= ""
publishedOnDate= "publicado em {{ .Date }}"
includedInCategories= "incluido em {{ .Categories }}"
views = "visualizações"
comments = "comentários"
author = "Autor"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Contrasinha"
encryptyAgain = ""
[single.includedIn]
categories = "incluido em {{ .Categories }}"
collections = "incluido em {{ .Collections }}"
both = "incluido em {{ .Categories }} e {{ .Collections }}"
[single.wordCount]
one = "Uma palavra"
other = "{{ .Count }} palavras"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Distribuie pe"
contents= "Cuprins"
repost= ""
publishedOnDate= "publicat la {{ .Date }}"
includedInCategories= "inclus în {{ .Categories }}"
views = "vizualizări"
comments = "comentarii"
author = "Autor"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Parolă"
encryptyAgain = ""
[single.includedIn]
categories = "inclus în {{ .Categories }}"
collections = "inclus în {{ .Collections }}"
both = "inclus în {{ .Categories }} și {{ .Collections }}"
[single.wordCount]
one = "Un cuvânt"
other = "{{ .Count }} cuvinte"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Поделиться в"
contents= "Содержание"
repost= ""
publishedOnDate= "Опубликовано {{ .Date }}"
includedInCategories= "включен в {{ .Categories }}"
views = "просмотров"
comments = "комментариев"
author = "Автор"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "арготизм"
encryptyAgain = ""
[single.includedIn]
categories = "включен в {{ .Categories }}"
collections = "включен в {{ .Collections }}"
both = "включен в {{ .Categories }} и {{ .Collections }}"
[single.wordCount]
one = "Одно слово"
other = "{{ .Count }} слов"
+5 -1
View File
@@ -106,7 +106,6 @@ other = "Подели на"
contents= "Садржаји"
repost= ""
publishedOnDate= "објављено {{ .Date }}"
includedInCategories= "укључено {{ .Categories }}"
views = "прегледа"
comments = "коментари"
author = "Аутор"
@@ -122,6 +121,11 @@ encryptedMessage = ""
password = "Паролица"
encryptyAgain = ""
[single.includedIn]
categories = "укључено {{ .Categories }}"
collections = "укључено {{ .Collections }}"
both = "укључено {{ .Categories }} и {{ .Collections }}"
[single.wordCount]
one = "Једна реч"
other = "{{ .Count }} речи"
+5 -1
View File
@@ -105,7 +105,6 @@ other = "Chia sẻ trên"
contents= "Nội dung"
repost= ""
publishedOnDate= "đăng ngày {{ .Date }}"
includedInCategories= "trong {{ .Categories }}"
views = "lượt xem"
comments = "bình luận"
author = "Tác giả"
@@ -121,6 +120,11 @@ encryptedMessage = ""
password = "Mật khẩu"
encryptyAgain = ""
[single.includedIn]
categories = "trong {{ .Categories }}"
collections = "trong {{ .Collections }}"
both = "trong {{ .Categories }} và {{ .Collections }}"
[single.wordCount]
one = "One word"
other = "{{ .Count }} từ"
+5 -1
View File
@@ -104,7 +104,6 @@ other = "分享到"
contents= "目录"
repost= "转载"
publishedOnDate= "发布于 {{ .Date }}"
includedInCategories= "收录于 {{ .Categories }}"
views = "次阅读"
comments = "条评论"
author = "作者"
@@ -120,6 +119,11 @@ encryptedMessage = "请输入密码"
password = "密码"
encryptyAgain = "重新加密"
[single.includedIn]
categories = "收录于 {{ .Categories }}"
collections = "收录于 {{ .Collections }}"
both = "收录于 {{ .Categories }} 和 {{ .Collections }}"
[single.wordCount]
other = "{{ .Count }} 字"
+5 -1
View File
@@ -104,7 +104,6 @@ other = "分享到"
contents= "目錄"
repost= "轉貼"
publishedOnDate= "發佈於 {{ .Date }}"
includedInCategories= "收錄於 {{ .Categories }}"
views = "次閱讀"
comments = "條評論"
author = "作者"
@@ -120,6 +119,11 @@ encryptedMessage = "請輸入密碼"
password = "密碼"
encryptyAgain = "重新加密"
[single.includedIn]
categories = "收錄於 {{ .Categories }}"
collections = "收錄於 {{ .Collections }}"
both = "收錄於 {{ .Categories }} 和 {{ .Collections }}"
[single.wordCount]
other = "{{ .Count }} 字"
+1 -10
View File
@@ -40,16 +40,7 @@
</span>
{{- end -}}
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&ensp;" -}}
&nbsp;<span class="post-category">
{{- dict "Categories" . | T "single.includedInCategories" | safeHTML -}}
</span>
{{- end -}}
{{- partial "single/post-included-in.html" . -}}
</div>
{{- /* Summary content */ -}}
@@ -0,0 +1,37 @@
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (
printf `<a href="%v" class="post-category" title="%v">%v %v</a>`
(partial "function/escapeurl.html" $category.RelPermalink)
(printf "%v - %v" (T "category") $category.Title)
(dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html")
$category.Title
) -}}
{{- end -}}
{{- $categoriesStr := delimit $categories "&ensp;" -}}
{{- $collections := slice -}}
{{- range .Params.collections -}}
{{- $collection := partialCached "function/path.html" . . | printf "/collections/%v" | $.Site.GetPage -}}
{{- $collections = $collections | append (
printf `<a href="%v" class="post-collection" title="%v">%v %v</a>`
(partial "function/escapeurl.html" $collection.RelPermalink)
(printf "%v - %v" (T "collection") $collection.Title)
(dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html")
$collection.Title
) -}}
{{- end -}}
{{- $collectionStr := delimit $collections "&ensp;" -}}
{{- if .Params.categories | or .Params.collections -}}
<span class="post-included-in">
{{- if not .Params.collections -}}
&nbsp;{{- dict "Categories" $categoriesStr | T "single.includedIn.categories" | safeHTML -}}
{{- else if not .Params.categories -}}
&nbsp;{{- dict "Collections" $collectionStr | T "single.includedIn.collections" | safeHTML -}}
{{- else -}}
&nbsp;{{- dict "Categories" $categoriesStr "Collections" $collectionStr | T "single.includedIn.both" | safeHTML -}}
{{- end -}}
</span>
{{- end -}}
+3 -13
View File
@@ -4,7 +4,7 @@
{{- $params := .Scratch.Get "params" -}}
{{- $toc := .Scratch.Get "toc" -}}
<aside class="toc" id="toc-auto">
<aside class="toc" id="toc-auto" aria-label="{{ T "single.contents" }}">
{{- /* Auto TOC */ -}}
{{- $tocEmpty := eq .TableOfContents `<nav id="TableOfContents"></nav>` -}}
{{- if (ne $toc.enable false) | and (ne $tocEmpty true) -}}
@@ -16,7 +16,7 @@
{{- end -}}
</aside>
<aside class="aside-custom">
<aside class="aside-custom" aria-label="Custom Aside">
<!-- put aside for later use -->
{{- partial (.Scratch.Get "customFilePath").aside . -}}
</aside>
@@ -48,17 +48,7 @@
<div class="post-meta">
<div class="post-meta-line">
{{- partial "single/post-author.html" . -}}
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
{{- $categories = $categories | append (printf `<a href="%v">%v %v</a>` (partial "function/escapeurl.html" $category.RelPermalink) (dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html") $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&ensp;" }}
<span class="post-category">
{{- dict "Categories" . | T "single.includedInCategories" | safeHTML -}}
</span>
{{- end -}}
{{- partial "single/post-included-in.html" . -}}
</div>
<div class="post-meta-line">
{{- with .PublishDate | dateFormat (.Site.Params.dateformat | default "2006-01-02") -}}