From 614823f4a1c6581aa2adedb4ef96ce7533b12991 Mon Sep 17 00:00:00 2001 From: HEIGE-PCloud Date: Tue, 26 Mar 2024 15:47:23 +0000 Subject: [PATCH] feat: support person icon on default author settings --- assets/css/main.css | 61 +------------------ exampleSite/config/_default/author.toml | 2 +- themes/DoIt/layouts/partials/meta/author.html | 11 +++- 3 files changed, 13 insertions(+), 61 deletions(-) diff --git a/assets/css/main.css b/assets/css/main.css index 02f076614..a7ba988b9 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -575,39 +575,23 @@ ul { --tw-backdrop-sepia: ; } -.tw-m-1 { - margin: 0.25rem; -} - -.tw-m-4 { - margin: 1rem; -} - .tw-my-4 { margin-top: 1rem; margin-bottom: 1rem; } -.tw-mr-1 { - margin-right: 0.25rem; -} - .tw-ml-4 { margin-left: 1rem; } -.tw-block { - display: block; +.tw-mr-1 { + margin-right: 0.25rem; } .tw-inline-block { display: inline-block; } -.tw-flex { - display: flex; -} - .tw-max-h-4 { max-height: 1rem; } @@ -616,52 +600,11 @@ ul { max-height: 2rem; } -.tw-max-h-16 { - max-height: 4rem; -} - -.tw-max-h-12 { - max-height: 3rem; -} - -.tw-max-h-6 { - max-height: 1.5rem; -} - -.tw-translate-y-1 { - --tw-translate-y: 0.25rem; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.tw-translate-y-\[-1\] { - --tw-translate-y: -1; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.tw-translate-y-\[-2\] { - --tw-translate-y: -2; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.tw-translate-y-\[-3\] { - --tw-translate-y: -3; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.tw-translate-y-\[-1px\] { - --tw-translate-y: -1px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - .tw-translate-y-\[-2px\] { --tw-translate-y: -2px; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } -.tw-items-center { - align-items: center; -} - .tw-rounded-full { border-radius: 9999px; } diff --git a/exampleSite/config/_default/author.toml b/exampleSite/config/_default/author.toml index d2ac168db..1350d2f91 100644 --- a/exampleSite/config/_default/author.toml +++ b/exampleSite/config/_default/author.toml @@ -5,4 +5,4 @@ name = "PCloud" email = "heige.pcloud@outlook.com" link = "https://github.com/HEIGE-PCloud" avatar = "/images/avatar.webp" -gravatarEmail = "" +gravatarEmail = "heige.pcloud@outlook.com" diff --git a/themes/DoIt/layouts/partials/meta/author.html b/themes/DoIt/layouts/partials/meta/author.html index d819e9073..e023e8ad9 100644 --- a/themes/DoIt/layouts/partials/meta/author.html +++ b/themes/DoIt/layouts/partials/meta/author.html @@ -29,7 +29,16 @@ {{- else -}} {{- $author := .Params.author | default .Site.Author.name | default (T "author") -}} {{- $link := .Params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}} + {{- $gravatar := 0 -}} + {{- with .Site.Author.gravataremail -}} + {{- $gravatar = md5 . | printf "https://www.gravatar.com/avatar/%v?s=240&d=mp" -}} + {{- end -}} + {{- $avatar := .Params.authoravatar | default .Site.Author.avatar | default $gravatar | default false -}} {{- $options := dict "Class" "author" "Destination" $link "Title" "Author" "Rel" "author" "Content" $author -}} - {{- partial "plugin/icon.html" $icon -}} + {{- if $avatar -}} + {{ $author }} avatar + {{- else -}} + {{- partial "plugin/icon.html" $icon -}} + {{- end -}} {{- partial "plugin/link.html" $options -}} {{- end -}}