From f07d5dc515d7c5a9d41fa3339e4ad735d09e21cd Mon Sep 17 00:00:00 2001 From: SOT-TECH <41361221+sot-tech@users.noreply.github.com> Date: Tue, 10 Aug 2021 11:28:43 +0300 Subject: [PATCH 01/34] feat(i18n): add `readingTime` russian translation (#297) --- i18n/ru.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i18n/ru.yaml b/i18n/ru.yaml index 863642e..65e3be6 100644 --- a/i18n/ru.yaml +++ b/i18n/ru.yaml @@ -29,6 +29,8 @@ article: other: Обновлено tableOfContents: other: Содержание + readingTime: + other: "Время чтения: {{ .Count }} мин." notFound: title: From bcbba1eed08faf1c8a479cbfe550b59307d9bfe5 Mon Sep 17 00:00:00 2001 From: zhixuan <59254886+zhixuan666@users.noreply.github.com> Date: Sun, 15 Aug 2021 18:12:56 +0900 Subject: [PATCH 02/34] fix(article): change `.article-time` classname to `.article-lastmod` (#306) --- assets/scss/partials/layout/article.scss | 2 +- layouts/partials/article/components/footer.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss index 4fd3118..7059853 100644 --- a/assets/scss/partials/layout/article.scss +++ b/assets/scss/partials/layout/article.scss @@ -71,7 +71,7 @@ text-transform: unset; } - .article-copyright { + .article-copyright, .article-lastmod { a { color: var(--body-text-color); } diff --git a/layouts/partials/article/components/footer.html b/layouts/partials/article/components/footer.html index c6a7662..6853921 100644 --- a/layouts/partials/article/components/footer.html +++ b/layouts/partials/article/components/footer.html @@ -9,9 +9,9 @@ {{ end }} {{- if ne .Lastmod .Date -}} -
+
{{ partial "helper/icon" "clock" }} - + {{ T "article.lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }}
From c4cd4bf9a174f9c273801f8859f662a85a58cbf5 Mon Sep 17 00:00:00 2001 From: zhixuan <59254886+zhixuan666@users.noreply.github.com> Date: Sun, 15 Aug 2021 19:03:59 +0900 Subject: [PATCH 03/34] feat(comments): giscus integration (#304) Co-authored-by: Jimmy Cai --- exampleSite/config.yaml | 15 +++++- .../partials/comments/provider/giscus.html | 49 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/comments/provider/giscus.html diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index ac67c62..425a142 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -93,6 +93,17 @@ params: path: lang: + giscus: + repo: + repoID: + category: + categoryID: + mapping: + lightTheme: + darkTheme: + reactionsEnabled: 1 + emitMetadata: 0 + widgets: enabled: - search @@ -143,8 +154,8 @@ menu: weight: -100 pre: home params: - ### For demonstration purpose, the home link will be open in a new tab - newTab: true + ### For demonstration purpose, the home link will be open in a new tab + newTab: true related: includeNewer: true diff --git a/layouts/partials/comments/provider/giscus.html b/layouts/partials/comments/provider/giscus.html new file mode 100644 index 0000000..f36ead9 --- /dev/null +++ b/layouts/partials/comments/provider/giscus.html @@ -0,0 +1,49 @@ +{{- with .Site.Params.comments.giscus -}} + + +{{- end -}} + From 90b6baccc14c589bd5453f9e396345879152a7a9 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Sun, 15 Aug 2021 12:05:12 +0200 Subject: [PATCH 04/34] release: 3.1.0 --- layouts/partials/footer/footer.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html index 6284349..51ef29d 100644 --- a/layouts/partials/footer/footer.html +++ b/layouts/partials/footer/footer.html @@ -1,4 +1,4 @@ -{{- $ThemeVersion := "3.0.0" -}} +{{- $ThemeVersion := "3.1.0" -}}
-
\ No newline at end of file + From 9f734a064703eab8c31f2b1bbc4a434be7574961 Mon Sep 17 00:00:00 2001 From: SSpirits Date: Mon, 16 Aug 2021 01:19:51 +0800 Subject: [PATCH 05/34] feat(comments): DisqusJS integration (#307) * add comment provider: DisqusJS * Simplify `if` condition, and format code * Load disqusjs.scss only when it's enabled * Use `let` instead of `var` Co-authored-by: sspirits Co-authored-by: Jimmy Cai --- assets/scss/partials/comments/disqusjs.scss | 394 ++++++++++++++++++ exampleSite/config.yaml | 7 + .../partials/comments/provider/disqusjs.html | 61 +++ 3 files changed, 462 insertions(+) create mode 100644 assets/scss/partials/comments/disqusjs.scss create mode 100644 layouts/partials/comments/provider/disqusjs.html diff --git a/assets/scss/partials/comments/disqusjs.scss b/assets/scss/partials/comments/disqusjs.scss new file mode 100644 index 0000000..eb270e3 --- /dev/null +++ b/assets/scss/partials/comments/disqusjs.scss @@ -0,0 +1,394 @@ +.disqus-container { + background-color: var(--card-background); + border-radius: var(--card-border-radius); + box-shadow: var(--shadow-l1); + padding: var(--card-padding); +} + +#dsqjs * { + margin: 0; + padding: 0 +} + +#dsqjs a { + text-decoration: none; + color: #076dd0 +} + +#dsqjs .dsqjs-hide { + display: none!important +} + +#dsqjs .dsqjs-disabled { + cursor: not-allowed; + opacity: .5 +} + +#dsqjs #dsqjs-msg { + text-align: center; + margin-top: 4px; + margin-bottom: 4px; + font-size: 14px +} + +#dsqjs #dsqjs-msg .dsqjs-msg-btn { + cursor: pointer +} + +#dsqjs .dsqjs-bullet { + line-height: 1.4; + margin: 0 2px +} + +#dsqjs .dsqjs-bullet:after { + color: #c2c6cc; + content: "·"; + font-weight: 700 +} + +#dsqjs .dsqjs-clearfix:after,#dsqjs .dsqjs-clearfix:before { + display: table; + content: ""; + line-height: 0; + clear: both +} + +#dsqjs .dsqjs-nav { + position: relative; + margin: 0 0 20px; + border-bottom: 2px solid #e7e9ee +} + +#dsqjs ol,#dsqjs ul { + list-style: none; + list-style-type: none +} + +#dsqjs .dsqjs-no-comment { + text-align: center; + font-size: 16px; + line-height: 1.5; + word-wrap: break-word; + overflow: hidden; + color: #2a2e2e; + margin-bottom: 6px +} + +#dsqjs .dsqjs-nav-tab { + float: left; + text-transform: capitalize; + font-size: 15px; + padding: 12px 8px; + color: #656c7a; + display: block; + margin: 0 15px 0 0; + font-weight: 700; + line-height: 1; + position: relative; + transition: all .2s ease-in-out +} + +#dsqjs .dsqjs-nav-tab:last-child { + margin: 0 +} + +#dsqjs .dsqjs-tab-active { + color: #2a2e2e +} + +#dsqjs .dsqjs-tab-active>span:after { + content: " "; + display: block; + height: 2px; + background-color: #076dd0!important; + position: absolute; + bottom: -5px; + left: 0; + right: 0 +} + +#dsqjs .dsqjs-post-list .dsqjs-post-item { + position: relative; + margin-bottom: 16px +} + +#dsqjs .dsqjs-post-list .dsqjs-post-avatar { + float: left; + margin-right: 10px; + position: relative; + background: #dbdfe4; + padding: 0; + display: block; + border-radius: 4px +} + +#dsqjs .dsqjs-post-list .dsqjs-post-avatar img { + width: 44px; + height: 44px; + display: block; + border-radius: 4px +} + +#dsqjs .dsqjs-post-list .dsqjs-post-header { + line-height: 1; + font-size: 14px; + margin-bottom: 3px +} + +#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-post-author { + color: #656c7a; + font-weight: 700 +} + +#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-admin-badge { + color: #fff; + background: #687a86; + padding: 1px 3px; + margin-left: 4px; + font-size: 12px; + line-height: 1; + font-weight: 700; + border-radius: 3px; + display: inline-block; + position: relative; + top: -1px; + left: 1px +} + +#dsqjs .dsqjs-post-list .dsqjs-post-header .dsqjs-meta { + display: inline-block; + font-size: 12px; + color: #656c7a +} + +#dsqjs .dsqjs-post-body { + font-size: 15px; + line-height: 1.5; + word-wrap: break-word; + overflow: hidden; + color: #2a2e2e +} + +#dsqjs .dsqjs-post-body code { + padding: .2em .4em; + margin: 0; + font-size: 85%; + background: #f5f5f5; + color: inherit; + border-radius: 3px +} + +#dsqjs .dsqjs-post-body pre { + padding: .5em; + overflow: auto; + font-size: 85%; + line-height: 1.45; + border-radius: 3px; + background: #f5f5f5; + margin: .5em 0 +} + +#dsqjs .dsqjs-post-body blockquote { + padding: 0 .8em; + margin: .5em 0; + color: #6a737d; + border-left: .25em solid #dfe2e5 +} + +#dsqjs .dsqjs-post-body p:last-child { + margin: 0 +} + +#dsqjs .dsqjs-post-list.dsqjs-children>li { + margin-left: 30px +} + +#dsqjs .dsqjs-post-list.dsqjs-children .dsqjs-post-avatar img { + width: 38px; + height: 38px +} + +#dsqjs .dsqjs-load-more { + font-size: 14px; + font-weight: 400; + display: block; + text-align: center; + padding: 11px 14px; + margin: 0 0 24px; + background: #687a86; + color: #fff; + cursor: pointer +} + +#dsqjs .dsqjs-load-more:hover { + opacity: .8 +} + +#dsqjs footer { + text-align: right; + line-height: 1.5; + padding-top: 10px; + padding-right: 10px; + border-top: 2px solid #e7e9ee; + margin-top: 12px; + font-weight: 700; + font-size: 16px; + color: #555 +} + +#dsqjs .dsqjs-disqus-logo { + background-image: url(https://c.disquscdn.com/next/embed/assets/img/sprite.654110a9206fd22f08cca0798e34a65e.png); + background-repeat: no-repeat; + display: inline-block; + background-size: 86px 40.5px; + height: 16.5px; + width: 86px; +} + +#dsqjs .dsqjs-order { + display: flex; + float: right; + align-items: center; + margin-top: 10px; + margin-bottom: 12px +} + +#dsqjs .dsqjs-order-radio { + display: none +} + +#dsqjs .dsqjs-order-radio:checked+.dsqjs-order-label { + color: #fff; + background-color: #888 +} + +#dsqjs .dsqjs-order-label { + display: block; + height: 20px; + line-height: 20px; + margin-right: 10px; + font-size: 12px; + border-radius: 2px; + padding: 0 5px; + background-color: #dcdcdc; + cursor: pointer +} + +#dsqjs p.dsqjs-has-more { + margin-bottom: 24px; + margin-left: 48px; + font-size: 13px; + line-height: 15px +} + +#dsqjs p.dsqjs-has-more a.dsqjs-has-more-btn { + color: #656c7a; + text-decoration: underline; + cursor: pointer +} + +@media (min-width: 768px) { + #dsqjs .dsqjs-post-list.dsqjs-children>li { + margin-left:48px + } + + #dsqjs .dsqjs-post-list .dsqjs-post-avatar { + margin-right: 12px + } + + #dsqjs .dsqjs-post-list .dsqjs-post-item { + margin-bottom: 20px + } +} + +@media (min-width: 1024px) { + #dsqjs .dsqjs-post-list.dsqjs-children>li { + margin-left:60px + } +} + +:root[data-scheme="light"] { + #dsqjs .dsqjs-disqus-logo { + background-position: 0 -7px; + } +} + +:root[data-scheme="dark"] { + #dsqjs { + --t-s: rgba(255,255,255,0.9); + --alt: #3e4b5e; + --link-hover: #47a2e0; + --hover-bg: #3e4b5e; + --tag: #3e4b5e; + --border: #435266; + --pre: #3c495b; + --c-bg: #2f3947; + --code: #c3c7cb; + --kbd: #4e5f77; + --hl: #abb2bf; + --hlc: #808895; + --hlk: #c678dd; + --hln: #e06c75; + --hll: #56b6c2; + --hls: #98c379; + --hlt: #e6c07b; + --hlv: #d19a66; + --bg: #181c27; + --main: #252d38; + --t: rgba(255,255,255,0.86); + --t-l: rgba(255,255,255,0.66); + --logo: #fff; + --link: #38a3fd; + --title: rgba(255,255,255,0.92); + --fab: #364151; + --shadow: none; + } + + #disqus_thread { + color: var(--body-text-color) + } + + #dsqjs #dsqjs-msg { + color: var(--t) + } + + #dsqjs a { + color:var(--link) + } + + #dsqjs a:focus,#dsqjs a:hover { + color: var(--link-hover) + } + + #dsqjs .dsqjs-disqus-logo { + background-position: 0 -24px; + } + + #dsqjs .dsqjs-nav,#dsqjs footer { + border-color: var(--hlc) + } + + #dsqjs .dsqjs-load-more,#dsqjs .dsqjs-load-more:hover,#dsqjs .dsqjs-nav-tab,#dsqjs .dsqjs-no-comment,#dsqjs .dsqjs-post-content { + color: var(--t) + } + + #dsqjs .dsqjs-order-label { + background-color: var(--hlc) + } + + #dsqjs .dsqjs-order-radio:checked+.dsqjs-order-label { + background-color: var(--kbd) + } + + #dsqjs .dsqjs-tab-active>span:after { + background-color: #2e9fff + } + + #dsqjs .dsqjs-footer,#dsqjs .dsqjs-meta { + color: var(--t-l) + } + + #dsqjs .dsqjs-post-body blockquote { + border-color: var(--border) + } +} diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 425a142..b602ff2 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -53,6 +53,13 @@ params: enabled: true provider: disqus + disqusjs: + shortname: + apiUrl: + apiKey: + admin: + adminLabel: + utterances: repo: issueTerm: pathname diff --git a/layouts/partials/comments/provider/disqusjs.html b/layouts/partials/comments/provider/disqusjs.html new file mode 100644 index 0000000..8dbcc13 --- /dev/null +++ b/layouts/partials/comments/provider/disqusjs.html @@ -0,0 +1,61 @@ +{{- $pc := .Site.Config.Privacy.Disqus -}} +{{- $disqusjs := .Site.Params.Comments.disqusjs -}} +{{- if and (not $pc.Disable) (and $disqusjs.Shortname $disqusjs.ApiKey) -}} + +{{- $style := resources.Get "scss/partials/comments/disqusjs.scss" | resources.ToCSS | minify -}} + + +
+
+ + +
+{{- end -}} \ No newline at end of file From fe94466ec4df74533fa29944ca56417d6d9f0c5d Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Tue, 24 Aug 2021 12:16:27 +0200 Subject: [PATCH 06/34] fix(config): doc link (#323) --- exampleSite/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index b602ff2..37e9f97 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -151,7 +151,7 @@ params: enabled: true ### Custom menu -### See https://docs.stack.jimmycai.com/configuration/custom-menu +### See https://docs.stack.jimmycai.com/configuration/custom-menu.html ### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter menu: main: From 626265bcfd3ebfe4a528cd367964a34b3ed9c5ab Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Wed, 25 Aug 2021 12:20:15 +0200 Subject: [PATCH 07/34] refactor(article): better support for svg and external images (#326) --- assets/ts/gallery.ts | 4 +- layouts/_default/_markup/render-image.html | 72 +++++++++++++--------- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/assets/ts/gallery.ts b/assets/ts/gallery.ts index 8bce5a9..5de13a2 100644 --- a/assets/ts/gallery.ts +++ b/assets/ts/gallery.ts @@ -34,7 +34,7 @@ class StackGallery { private loadItems(container: HTMLElement) { this.items = []; - const figures = container.querySelectorAll('figure'); + const figures = container.querySelectorAll('figure.gallery-image'); for (const el of figures) { const figcaption = el.querySelector('figcaption'), @@ -57,7 +57,7 @@ class StackGallery { } public static createGallery(container: HTMLElement) { - const figuresEl = container.querySelectorAll('figure'); + const figuresEl = container.querySelectorAll('figure.gallery-image'); let currentGallery = []; diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index fbaba27..0325458 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,30 +1,46 @@ {{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}} -{{- if and $image (ne (path.Ext .Destination) ".svg") -}} - {{- $alt := .PlainText | safeHTML -}} -
- - {{- $Permalink := $image.RelPermalink -}} - {{- $Width := $image.Width -}} - {{- $Height := $image.Height -}} - {{- $Srcset := "" -}} +{{- $Permalink := .Destination | relURL | safeURL -}} +{{- $alt := .PlainText | safeHTML -}} +{{- $Width := 0 -}} +{{- $Height := 0 -}} +{{- $Srcset := "" -}} - {{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}} - {{- $small := $image.Resize "480x" -}} - {{- $big := $image.Resize "1024x" -}} - {{- $Srcset = printf "%s 480w, %s 1024w" $small.RelPermalink $big.RelPermalink -}} - {{- end -}} - - - - {{ with $alt }} -
{{ . | markdownify }}
- {{ end }} -
-{{- else -}} - {{ .Text }} -{{- end -}} \ No newline at end of file +{{/* SVG and external images won't work with gallery layout, because their width and height attributes are unknown */}} +{{- $galleryImage := false -}} + +{{- if $image -}} + {{- $notSVG := ne (path.Ext .Destination) ".svg" -}} + {{- $Permalink = $image.RelPermalink -}} + + {{- if $notSVG -}} + {{- $Width = $image.Width -}} + {{- $Height = $image.Height -}} + {{- $galleryImage = true -}} + + {{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}} + {{- $small := $image.Resize `480x` -}} + {{- $big := $image.Resize `1024x` -}} + {{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}} + {{- end -}} + {{- end -}} +{{- end -}} + + \ No newline at end of file From 2013c50abe6c4ce15ae553d2a9bb17dd73be1d45 Mon Sep 17 00:00:00 2001 From: MikDal002 Date: Wed, 25 Aug 2021 12:23:50 +0200 Subject: [PATCH 08/34] feat(i18n): add PL translation for reading time (#325) --- i18n/pl.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/i18n/pl.yaml b/i18n/pl.yaml index 455e682..f261f86 100644 --- a/i18n/pl.yaml +++ b/i18n/pl.yaml @@ -28,6 +28,10 @@ article: lastUpdatedOn: other: Ostatnio zaktualizowany + + readingTime: + one: "Przeczytasz w {{ .Count }} minutę" + other: "Przeczytasz w {{ .Count }} minut" notFound: title: From e24f5672c3bf9680fbc529b43562a94a05c90333 Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Wed, 25 Aug 2021 12:25:11 +0200 Subject: [PATCH 09/34] release: 3.2.0 --- layouts/partials/footer/footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html index 51ef29d..9174dd1 100644 --- a/layouts/partials/footer/footer.html +++ b/layouts/partials/footer/footer.html @@ -1,4 +1,4 @@ -{{- $ThemeVersion := "3.1.0" -}} +{{- $ThemeVersion := "3.2.0" -}}