From a25e6463bdc9900e5f999d276a0e5d92ee1f8d9a Mon Sep 17 00:00:00 2001 From: Hendra Manudinata <87532060+manudinath@users.noreply.github.com> Date: Fri, 23 Jul 2021 16:56:52 +0800 Subject: [PATCH 1/3] feat(sidebar): add option to disable avatar in left sidebar (#268) * Allow to disable logo image in left sidebar * Enable sidebar avatar by default for backward compatibility Co-authored-by: Jimmy Cai --- exampleSite/config.yaml | 1 + layouts/partials/sidebar/left.html | 2 ++ 2 files changed, 3 insertions(+) diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 578c574..de5d951 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -37,6 +37,7 @@ params: emoji: 🍥 subtitle: Lorem ipsum dolor sit amet, consectetur adipiscing elit. avatar: + enabled: true local: true src: img/avatar.png diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index c7158bb..af483e3 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -7,6 +7,7 @@
{{ with .Site.Params.sidebar.avatar }} + {{ if (default true .enabled) }}
{{ if not .local }} @@ -26,6 +27,7 @@ {{ . }} {{ end }}
+ {{ end }} {{ end }}

{{ .Site.Title }}

{{ .Site.Params.sidebar.subtitle }}

From dcfc7b55895146380eabb511b5aaf9835f1f5e36 Mon Sep 17 00:00:00 2001 From: Bachrul uluum <49960993+uluumbch@users.noreply.github.com> Date: Fri, 23 Jul 2021 23:37:30 +0700 Subject: [PATCH 2/3] feat(article): reading time (#204) * add reading time feature * Revert change in jsconfig.json * feat: add article.readingTime param, and improve style * Revert change in jsconfig.json x2 * Remove reading time in compact layout It doesn't look right to me for now * feat: add i18n support to reading time string * Hide footer.article-time when there's not content Co-authored-by: Jimmy Cai --- assets/icons/date.svg | 9 +++++++ assets/scss/partials/article.scss | 7 ++++++ exampleSite/config.yaml | 1 + i18n/en.yaml | 5 ++++ .../partials/article/components/details.html | 25 ++++++++++++++----- 5 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 assets/icons/date.svg diff --git a/assets/icons/date.svg b/assets/icons/date.svg new file mode 100644 index 0000000..ed92a90 --- /dev/null +++ b/assets/icons/date.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/assets/scss/partials/article.scss b/assets/scss/partials/article.scss index c71cab4..459c22f 100644 --- a/assets/scss/partials/article.scss +++ b/assets/scss/partials/article.scss @@ -95,7 +95,9 @@ display: flex; align-items: center; color: var(--card-text-color-tertiary); + gap: 15px; margin-top: 10px; + flex-wrap: wrap; svg { vertical-align: middle; @@ -108,6 +110,11 @@ time { font-size: 1.4rem; } + + & > div { + display: inline-flex; + align-items: center; + } } .article-category, diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index de5d951..2ff6a1e 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -44,6 +44,7 @@ params: article: math: false toc: true + readingTime: true license: enabled: true default: Licensed under CC BY-NC-SA 4.0 diff --git a/i18n/en.yaml b/i18n/en.yaml index 21b1310..e279278 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -29,6 +29,11 @@ article: lastUpdatedOn: other: Last updated on + readingTime: + one: "{{ .Count }} min read" + ### Seems that there's no need to add 's' even if it's plural in English + other: "{{ .Count }} min read" + notFound: title: other: Not Found diff --git a/layouts/partials/article/components/details.html b/layouts/partials/article/components/details.html index 5c5397b..64d6c6e 100644 --- a/layouts/partials/article/components/details.html +++ b/layouts/partials/article/components/details.html @@ -21,12 +21,25 @@ {{ end }} - {{- if not .Date.IsZero -}} + {{ if or (not .Date.IsZero) (.Site.Params.article.readingTime) }}
- {{ partial "helper/icon" "clock" }} - + {{ if not .Date.IsZero }} +
+ {{ partial "helper/icon" "date" }} + +
+ {{ end }} + + {{ if .Site.Params.article.readingTime }} +
+ {{ partial "helper/icon" "clock" }} + +
+ {{ end }}
- {{- end -}} + {{ end }} \ No newline at end of file From 44e3d20bad845a515657308d38692e7f431b4d05 Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Mon, 26 Jul 2021 05:50:52 +1200 Subject: [PATCH 3/3] feat(article): use `markdownify` for licence in article (#273) * Use markdownify for licence in article So we can use links, e.g. to credits for main photo. * refactor: move .article-copyright style to partials/layout/article Co-authored-by: Jimmy Cai --- assets/scss/partials/layout/article.scss | 6 ++++++ layouts/partials/article/components/footer.html | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss index ebf94a7..5331a61 100644 --- a/assets/scss/partials/layout/article.scss +++ b/assets/scss/partials/layout/article.scss @@ -70,6 +70,12 @@ flex-wrap: wrap; text-transform: unset; } + + .article-copyright { + a { + color: var(--body-text-color); + } + } } } } diff --git a/layouts/partials/article/components/footer.html b/layouts/partials/article/components/footer.html index f518d76..c6a7662 100644 --- a/layouts/partials/article/components/footer.html +++ b/layouts/partials/article/components/footer.html @@ -4,7 +4,7 @@ {{ if and (.Site.Params.article.license.enabled) (not (eq .Params.license false)) }}
{{ partial "helper/icon" "copyright" }} - {{ default .Site.Params.article.license.default .Params.license }} + {{ default .Site.Params.article.license.default .Params.license | markdownify }}
{{ end }} @@ -16,4 +16,4 @@ {{- end -}} - \ No newline at end of file +