From da54fef1519ffe7e8bfc5fb9964b17c7d22196c8 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 27 Dec 2023 16:30:36 +0800 Subject: [PATCH] :sparkles: Feat: add pin icon in home post list and add repost icon in section .etc. --- assets/css/_core/_common.scss | 8 ++++---- assets/css/_page/_single.scss | 16 ++++++++++------ i18n/de.toml | 7 ++++--- i18n/en.toml | 1 + i18n/es.toml | 7 ++++--- i18n/fr.toml | 7 ++++--- i18n/it.toml | 7 ++++--- i18n/pl.toml | 7 ++++--- i18n/pt-BR.toml | 7 ++++--- i18n/ro.toml | 7 ++++--- i18n/ru.toml | 7 ++++--- i18n/sr.toml | 7 ++++--- i18n/vi.toml | 7 ++++--- i18n/zh-CN.toml | 7 ++++--- i18n/zh-TW.toml | 7 ++++--- layouts/_default/section.html | 8 +++++++- layouts/_default/summary.html | 6 +++++- layouts/taxonomy/list.html | 8 +++++++- layouts/taxonomy/terms/categories.html | 8 +++++++- layouts/taxonomy/terms/collections.html | 8 +++++++- 20 files changed, 96 insertions(+), 51 deletions(-) diff --git a/assets/css/_core/_common.scss b/assets/css/_core/_common.scss index c845a569..fbf77d6d 100644 --- a/assets/css/_core/_common.scss +++ b/assets/css/_core/_common.scss @@ -30,19 +30,19 @@ .ms-1, .mx-1 { - margin-left: 0.25rem !important; + margin-left: 0.25em !important; } .me-1, .mx-1 { - margin-right: 0.25rem !important; + margin-right: 0.25em !important; } .ps-1, .px-1 { - padding-left: 0.25rem !important; + padding-left: 0.25em !important; } .pe-1, .px-1 { - padding-right: 0.25rem !important; + padding-right: 0.25em !important; } @each $color, $value in $theme-colors { diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index c865c39b..f22c604b 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -10,15 +10,19 @@ font-weight: bold; line-height: 140%; - .icon-repost { - color: var(--#{$prefix}success); + .icon-pin { display: inline-block; width: max-content; - margin-right: 0.25rem; + transform: rotate(30deg); + margin-right: 0.25em; + @extend .text-danger; + } - [data-theme='dark'] & { - color: var(--#{$prefix}success-dark); - } + .icon-repost { + display: inline-block; + width: max-content; + margin-right: 0.25em; + @extend .text-success; } } diff --git a/i18n/de.toml b/i18n/de.toml index 0563f8bf..9bcdec41 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -103,9 +103,10 @@ other = "Teilen auf" # === posts/single.html === [single] -contents= "Inhalt" -repost= "" -publishedOnDate= "veröffentlicht an {{ .Date }}" +contents = "Inhalt" +pin = "" +repost = "" +publishedOnDate = "veröffentlicht an {{ .Date }}" views = "Aufrufe" comments = "Kommentare" author = "Autor" diff --git a/i18n/en.toml b/i18n/en.toml index dd85ee71..42736b95 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -103,6 +103,7 @@ other = "Share on" # === posts/single.html === [single] contents = "Contents" +pin = "Pin to top" repost = "Repost" publishedOnDate = "published on {{ .Date }}" views = "views" diff --git a/i18n/es.toml b/i18n/es.toml index 4534485d..ce396719 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -103,9 +103,10 @@ other = "Compartir en" # === posts/single.html === [single] -contents= "Contenido" -repost= "" -publishedOnDate= "publicado el {{ .Date }}" +contents = "Contenido" +pin = "" +repost = "" +publishedOnDate = "publicado el {{ .Date }}" views = "vistas" comments = "Comentarios" author = "Autor" diff --git a/i18n/fr.toml b/i18n/fr.toml index 807e9b4a..42f95580 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -102,9 +102,10 @@ other = "Partager via" # === posts/single.html === [single] -contents= "Contenus" -repost= "Reposter" -publishedOnDate= "publié le {{ .Date }}" +contents = "Contenus" +pin = "" +repost = "Reposter" +publishedOnDate = "publié le {{ .Date }}" views = "vues" comments = "commentaires" author = "Auteur" diff --git a/i18n/it.toml b/i18n/it.toml index d2f52adc..57ae80db 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -103,9 +103,10 @@ other = "Condividi su" # === posts/single.html === [single] -contents= "Contenuti" -repost= "" -publishedOnDate= "pubblicato su {{ .Date }}" +contents = "Contenuti" +pin = "" +repost = "" +publishedOnDate = "pubblicato su {{ .Date }}" views = "visualizzazioni" comments = "commenti" author = "Autore" diff --git a/i18n/pl.toml b/i18n/pl.toml index 62573c42..0c258da1 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -103,9 +103,10 @@ other = "Udostępnij na" # === posts/single.html === [single] -contents= "Spis treści" -repost= "" -publishedOnDate= "opublikowano {{ .Date }}" +contents = "Spis treści" +pin = "" +repost = "" +publishedOnDate = "opublikowano {{ .Date }}" views = "wyświetleń" comments = "komentarzy" author = "Autor" diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index fc0357f4..ec4b5d32 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -103,9 +103,10 @@ other = "Compartilhe em" # === posts/single.html === [single] -contents= "Conteúdos" -repost= "" -publishedOnDate= "publicado em {{ .Date }}" +contents = "Conteúdos" +pin = "" +repost = "" +publishedOnDate = "publicado em {{ .Date }}" views = "visualizações" comments = "comentários" author = "Autor" diff --git a/i18n/ro.toml b/i18n/ro.toml index 9a94d078..1ede3de8 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -103,9 +103,10 @@ other = "Distribuie pe" # === posts/single.html === [single] -contents= "Cuprins" -repost= "" -publishedOnDate= "publicat la {{ .Date }}" +contents = "Cuprins" +pin = "" +repost = "" +publishedOnDate = "publicat la {{ .Date }}" views = "vizualizări" comments = "comentarii" author = "Autor" diff --git a/i18n/ru.toml b/i18n/ru.toml index 37525256..34fa99c5 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -103,9 +103,10 @@ other = "Поделиться в" # === posts/single.html === [single] -contents= "Содержание" -repost= "" -publishedOnDate= "Опубликовано {{ .Date }}" +contents = "Содержание" +pin = "" +repost = "" +publishedOnDate = "Опубликовано {{ .Date }}" views = "просмотров" comments = "комментариев" author = "Автор" diff --git a/i18n/sr.toml b/i18n/sr.toml index 0437b517..1488b529 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -103,9 +103,10 @@ other = "Подели на" # === posts/single.html === [single] -contents= "Садржаји" -repost= "" -publishedOnDate= "објављено {{ .Date }}" +contents = "Садржаји" +pin = "" +repost = "" +publishedOnDate = "објављено {{ .Date }}" views = "прегледа" comments = "коментари" author = "Аутор" diff --git a/i18n/vi.toml b/i18n/vi.toml index 24954c2f..4d4448c1 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -102,9 +102,10 @@ other = "Chia sẻ trên" # === posts/single.html === [single] -contents= "Nội dung" -repost= "" -publishedOnDate= "đăng ngày {{ .Date }}" +contents = "Nội dung" +pin = "" +repost = "" +publishedOnDate = "đăng ngày {{ .Date }}" views = "lượt xem" comments = "bình luận" author = "Tác giả" diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index 11c184c3..65d70dbf 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -101,9 +101,10 @@ other = "分享到" # === posts/single.html === [single] -contents= "目录" -repost= "转载" -publishedOnDate= "发布于 {{ .Date }}" +contents = "目录" +pin = "置顶" +repost = "转载" +publishedOnDate = "发布于 {{ .Date }}" views = "次阅读" comments = "条评论" author = "作者" diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index e5325233..ce0c0406 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -101,9 +101,10 @@ other = "分享到" # === posts/single.html === [single] -contents= "目錄" -repost= "轉貼" -publishedOnDate= "發佈於 {{ .Date }}" +contents = "目錄" +pin = "置頂" +repost = "轉貼" +publishedOnDate = "發佈於 {{ .Date }}" views = "次閱讀" comments = "條評論" author = "作者" diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 58f9f4ce..c69e699d 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -40,7 +40,13 @@

{{ .Key }}

{{- range .Pages -}}
- {{- .LinkTitle -}} + + {{- $repost := .Params.repost | default dict -}} + {{- if eq $repost.enable true -}} + {{- dict "Class" "fa-solid fa-share fa-fw text-success me-1" | partial "plugin/icon.html" -}} + {{- end -}} + {{- .LinkTitle -}} + {{- .Date | dateFormat ($.Site.Params.section.dateFormat | default "01-02") -}} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 8ab1eb81..52a54148 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -19,7 +19,11 @@ {{- /* Title */ -}}

- {{ $repost := $params.repost | default dict }} + {{- with $params.weight -}} + {{- $icon := dict "Class" "fa-solid fa-thumbtack fa-fw" -}} + {{- $icon | partial "plugin/icon.html" -}} + {{- end -}} + {{- $repost := $params.repost | default dict -}} {{- with $repost -}} {{- if eq .Enable true -}} {{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html index f8723bec..fbc45289 100644 --- a/layouts/taxonomy/list.html +++ b/layouts/taxonomy/list.html @@ -37,7 +37,13 @@

{{ .Key }}

{{- range .Pages -}}
- {{- .LinkTitle -}} + + {{- $repost := .Params.repost | default dict -}} + {{- if eq $repost.enable true -}} + {{- dict "Class" "fa-solid fa-share fa-fw text-success me-1" | partial "plugin/icon.html" -}} + {{- end -}} + {{- .LinkTitle -}} + {{- .Date | dateFormat ($.Site.Params.list.dateFormat | default "01-02") -}} diff --git a/layouts/taxonomy/terms/categories.html b/layouts/taxonomy/terms/categories.html index 812bf9e3..71be42dd 100644 --- a/layouts/taxonomy/terms/categories.html +++ b/layouts/taxonomy/terms/categories.html @@ -15,7 +15,13 @@ {{- range first 5 $pages -}} {{- end -}} {{- if gt (len $pages) 5 -}} diff --git a/layouts/taxonomy/terms/collections.html b/layouts/taxonomy/terms/collections.html index 4ca16184..f0b84282 100644 --- a/layouts/taxonomy/terms/collections.html +++ b/layouts/taxonomy/terms/collections.html @@ -15,7 +15,13 @@ {{- range first 5 $pages -}} {{- end -}} {{- if gt (len $pages) 5 -}}