@@ -264,4 +326,4 @@ window.addEventListener('load', () => {
}, 0);
})
-export default Search;
\ No newline at end of file
+export default Search;
diff --git a/assets/ts/smoothAnchors.ts b/assets/ts/smoothAnchors.ts
new file mode 100644
index 0000000..0718bf5
--- /dev/null
+++ b/assets/ts/smoothAnchors.ts
@@ -0,0 +1,34 @@
+// Implements smooth scrolling when clicking on an anchor link.
+// This is required instead of using modern CSS because Chromium does not currently support scrolling
+// one element with scrollTo while another element is scrolled because of a click on a link. This would
+// thus not work with the ToC scrollspy and e.g. footnotes.
+
+// Here are additional links about this issue:
+// - https://stackoverflow.com/questions/49318497/google-chrome-simultaneously-smooth-scrollintoview-with-more-elements-doesn
+// - https://stackoverflow.com/questions/57214373/scrollintoview-using-smooth-function-on-multiple-elements-in-chrome
+// - https://bugs.chromium.org/p/chromium/issues/detail?id=833617
+// - https://bugs.chromium.org/p/chromium/issues/detail?id=1043933
+// - https://bugs.chromium.org/p/chromium/issues/detail?id=1121151
+
+const anchorLinksQuery = "a[href]";
+
+function setupSmoothAnchors() {
+ document.querySelectorAll(anchorLinksQuery).forEach(aElement => {
+ let href = aElement.getAttribute("href");
+ if (!href.startsWith("#")) {
+ return;
+ }
+ aElement.addEventListener("click", clickEvent => {
+ clickEvent.preventDefault();
+
+ let targetId = aElement.getAttribute("href").substring(1);
+ // The replace done on ':' is here for footnotes, as this character would otherwise interfere when used as a CSS selector.
+ let target = document.querySelector(`#${targetId.replace(":", "\\:")}`) as HTMLElement;
+
+ window.history.pushState({}, "", aElement.getAttribute("href"));
+ scrollTo({ top: target.offsetTop, behavior: "smooth" });
+ });
+ });
+}
+
+export { setupSmoothAnchors };
\ No newline at end of file
diff --git a/config.yaml b/config.yaml
index 0e5283c..93367bb 100644
--- a/config.yaml
+++ b/config.yaml
@@ -19,6 +19,7 @@ params:
lastUpdated: Jan 02, 2006 15:04 MST
sidebar:
+ compact: false
emoji:
subtitle:
avatar:
@@ -95,6 +96,7 @@ params:
darkTheme:
reactionsEnabled: 1
emitMetadata: 0
+ lang:
gitalk:
owner:
@@ -108,16 +110,8 @@ params:
id:
widgets:
- enabled:
- - search
- - archives
- - tag-cloud
-
- archives:
- limit: 5
-
- tagCloud:
- limit: 10
+ homepage: []
+ page: []
opengraph:
twitter:
diff --git a/data/external.yaml b/data/external.yaml
index 427c8aa..fd2b665 100644
--- a/data/external.yaml
+++ b/data/external.yaml
@@ -36,3 +36,11 @@ KaTeX:
integrity: sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl
type: script
defer: true
+
+Cactus:
+ - src: https://latest.cactus.chat/cactus.js
+ integrity:
+ type: script
+ - src: https://latest.cactus.chat/style.css
+ integrity:
+ type: style
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 28958ae..ea576c2 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -4,6 +4,21 @@ theme: hugo-theme-stack
paginate: 5
title: Example Site
+languages:
+ en:
+ languageName: English
+ title: Example Site
+ weight: 1
+ zh-cn:
+ languageName: 中文
+ title: 演示站点
+ weight: 2
+ ar:
+ languageName: عربي
+ languagedirection: rtl
+ title: موقع تجريبي
+ weight: 3
+
# Change it to your Disqus shortname before using
disqusShortname: hugo-theme-stack
@@ -11,7 +26,7 @@ disqusShortname: hugo-theme-stack
googleAnalytics:
# Theme i18n support
-# Available values: en, fr, id, ja, ko, pt-br, zh-cn, zh-tw, es, de, nl, it, th, el, uk
+# Available values: ar, ca, de, el, en, es, fr, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
DefaultContentLanguage: en
# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
@@ -104,6 +119,12 @@ params:
path:
lang:
+ # See https://cactus.chat/docs/reference/web-client/#configuration for description of the various options
+ cactus:
+ defaultHomeserverUrl: "https://matrix.cactus.chat:8448"
+ serverName: "cactus.chat"
+ siteName: "" # You must insert a unique identifier here matching the one you registered (See https://cactus.chat/docs/getting-started/quick-start/#register-your-site)
+
giscus:
repo:
repoID:
@@ -116,27 +137,29 @@ params:
emitMetadata: 0
gitalk:
- owner:
- admin:
- repo:
- clientID:
- clientSecret:
-
+ owner:
+ admin:
+ repo:
+ clientID:
+ clientSecret:
+
cusdis:
- host:
- id:
-
+ host:
+ id:
widgets:
- enabled:
- - search
- - archives
- - tag-cloud
-
- archives:
- limit: 5
-
- tagCloud:
- limit: 10
+ homepage:
+ - type: search
+ - type: archives
+ params:
+ limit: 5
+ - type: categories
+ params:
+ limit: 10
+ - type: tag-cloud
+ params:
+ limit: 10
+ page:
+ - type: toc
opengraph:
twitter:
@@ -169,28 +192,20 @@ params:
### 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:
- - identifier: home
- name: Home
- url: /
- weight: -100
- params:
- ### For demonstration purpose, the home link will be open in a new tab
- newTab: true
- icon: home
-
+ main: []
+
social:
- identifier: github
name: GitHub
url: https://github.com/CaiJimmy/hugo-theme-stack
params:
- icon: brand-github
-
+ icon: brand-github
+
- identifier: twitter
name: Twitter
url: https://twitter.com
params:
- icon: brand-twitter
+ icon: brand-twitter
related:
includeNewer: true
@@ -214,3 +229,9 @@ markup:
startLevel: 2
highlight:
noClasses: false
+ codeFences: true
+ guessSyntax: true
+ lineNoStart: 1
+ lineNos: true
+ lineNumbersInTable: true
+ tabWidth: 4
diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md
new file mode 100644
index 0000000..530dfe8
--- /dev/null
+++ b/exampleSite/content/_index.md
@@ -0,0 +1,8 @@
+---
+menu:
+ main:
+ name: Home
+ weight: -100
+ params:
+ icon: home
+---
\ No newline at end of file
diff --git a/exampleSite/content/_index.zh-cn.md b/exampleSite/content/_index.zh-cn.md
new file mode 100644
index 0000000..e4b59a8
--- /dev/null
+++ b/exampleSite/content/_index.zh-cn.md
@@ -0,0 +1,8 @@
+---
+menu:
+ main:
+ name: 主页
+ weight: -100
+ params:
+ icon: home
+---
\ No newline at end of file
diff --git a/exampleSite/content/page/about/index.zh-cn.md b/exampleSite/content/page/about/index.zh-cn.md
new file mode 100644
index 0000000..0284003
--- /dev/null
+++ b/exampleSite/content/page/about/index.zh-cn.md
@@ -0,0 +1,10 @@
+---
+title: 关于
+menu:
+ main:
+ weight: -90
+ params:
+ icon: user
+---
+
+This is a test page for i18n support.
\ No newline at end of file
diff --git a/exampleSite/content/post/chinese-test/index.md b/exampleSite/content/post/chinese-test/index.zh-cn.md
similarity index 100%
rename from exampleSite/content/post/chinese-test/index.md
rename to exampleSite/content/post/chinese-test/index.zh-cn.md
diff --git a/exampleSite/content/post/markdown-syntax/index.md b/exampleSite/content/post/markdown-syntax/index.md
index 85fdcff..0254cca 100644
--- a/exampleSite/content/post/markdown-syntax/index.md
+++ b/exampleSite/content/post/markdown-syntax/index.md
@@ -69,6 +69,10 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou
| -------- | -------- | ------ |
| *italics* | **bold** | `code` |
+| A | B | C | D | E | F |
+|----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|------------------------------------------------------------|----------------------------------------------------------------------|
+| Lorem ipsum dolor sit amet, consectetur adipiscing elit. | Phasellus ultricies, sapien non euismod aliquam, dui ligula tincidunt odio, at accumsan nulla sapien eget ex. | Proin eleifend dictum ipsum, non euismod ipsum pulvinar et. Vivamus sollicitudin, quam in pulvinar aliquam, metus elit pretium purus | Proin sit amet velit nec enim imperdiet vehicula. | Ut bibendum vestibulum quam, eu egestas turpis gravida nec | Sed scelerisque nec turpis vel viverra. Vivamus vitae pretium sapien |
+
## Code Blocks
#### Code block with backticks
@@ -158,3 +162,7 @@ X
n + Y
n = Z
n
Press
CTRL+ALT+Delete to end the session.
Most
salamanders are nocturnal, and hunt for insects, worms, and other small creatures.
+
+## Hyperlinked image
+
+[](https://google.com)
\ No newline at end of file
diff --git a/exampleSite/content/post/placeholder-text/index.ar.md b/exampleSite/content/post/placeholder-text/index.ar.md
new file mode 100644
index 0000000..b0328f4
--- /dev/null
+++ b/exampleSite/content/post/placeholder-text/index.ar.md
@@ -0,0 +1,32 @@
++++
+author = "Hugo Authors"
+title = "مثال نص"
+date = "2019-03-09"
+description = "هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة"
+categories = [
+ "تجربة",
+ "تجربة مع فراغات"
+]
+tags = [
+ "ماركداون",
+ "نص",
+ "وسم مع فراغات"
+]
+image = "matt-le-SJSpo9hQf7s-unsplash.jpg"
++++
+## فقرة 1
+
+هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من [مولد النص العربى](https://colorslab.com/textgator/)، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق.
+إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع.
+ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق.
+هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.
+
+## فقرة 2
+
+هذا النص هو مثال لنص يمكن أن يستبدل في نفس المساحة، لقد تم توليد هذا النص من [مولد النص العربى](https://colorslab.com/textgator/)، حيث يمكنك أن تولد مثل هذا النص أو العديد من النصوص الأخرى إضافة إلى زيادة عدد الحروف التى يولدها التطبيق.
+إذا كنت تحتاج إلى عدد أكبر من الفقرات يتيح لك مولد النص العربى زيادة عدد الفقرات كما تريد، النص لن يبدو مقسما ولا يحوي أخطاء لغوية، مولد النص العربى مفيد لمصممي المواقع على وجه الخصوص، حيث يحتاج العميل فى كثير من الأحيان أن يطلع على صورة حقيقية لتصميم الموقع.
+ومن هنا وجب على المصمم أن يضع نصوصا مؤقتة على التصميم ليظهر للعميل الشكل كاملاً،دور مولد النص العربى أن يوفر على المصمم عناء البحث عن نص بديل لا علاقة له بالموضوع الذى يتحدث عنه التصميم فيظهر بشكل لا يليق.
+هذا النص يمكن أن يتم تركيبه على أي تصميم دون مشكلة فلن يبدو وكأنه نص منسوخ، غير منظم، غير منسق، أو حتى غير مفهوم. لأنه مازال نصاً بديلاً ومؤقتاً.
+
+## تجربة RTL
+كلمة 1 Text كلمة 2
diff --git a/exampleSite/content/post/rich-content/index.md b/exampleSite/content/post/rich-content/index.md
index af8a390..f2b45db 100644
--- a/exampleSite/content/post/rich-content/index.md
+++ b/exampleSite/content/post/rich-content/index.md
@@ -36,3 +36,7 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
## bilibilibi Shortcode
{{< bilibili av498363026 >}}
+
+## Gist Shortcode
+
+{{< gist spf13 7896402 >}}
\ No newline at end of file
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..63df635
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module github.com/CaiJimmy/hugo-theme-stack/v3
+
+go 1.17
diff --git a/i18n/ar.yaml b/i18n/ar.yaml
new file mode 100644
index 0000000..8af7ff9
--- /dev/null
+++ b/i18n/ar.yaml
@@ -0,0 +1,70 @@
+toggleMenu:
+ other: اخفي القائمة
+
+darkMode:
+ other: الوضع الداكن
+
+list:
+ page:
+ one: "{{ .Count }} صفحه"
+ other: "{{ .Count }} صفحات"
+
+ section:
+ other: قسم
+
+ subsection:
+ one: قسم فرعي
+ other: اقسام فرعية
+
+article:
+ back:
+ other: خلف
+
+ tableOfContents:
+ other: جدول المحتويات
+
+ relatedContents:
+ other: محتوى مشابهه
+
+ lastUpdatedOn:
+ other: التعديل الاخير
+
+ readingTime:
+ one: "تُقرأ خلال دقيقة"
+ other: "تُقرأ خلال {{ .Count }} دقائق"
+
+notFound:
+ title:
+ other: غير موجود
+
+ subtitle:
+ other: تعذر العثور على الصفحة المطلوبة.
+
+widget:
+ archives:
+ title:
+ other: الارشيفات
+
+ more:
+ other: اكثر
+
+ tagCloud:
+ title:
+ other: وسوم
+
+search:
+ title:
+ other: بحث
+
+ placeholder:
+ other: اكتب...
+
+ resultTitle:
+ other: "#PAGES_COUNT نتيجة (#TIME_SECONDS ثواني)"
+
+footer:
+ builtWith:
+ other: "مبني بستخدام {{ .Generator }}"
+
+ designedBy:
+ other: "قالب {{ .Theme }} مصمم من {{ .DesignedBy }}"
diff --git a/i18n/ca.yaml b/i18n/ca.yaml
new file mode 100644
index 0000000..33ad70e
--- /dev/null
+++ b/i18n/ca.yaml
@@ -0,0 +1,73 @@
+toggleMenu:
+ other: Toggle Menu
+
+darkMode:
+ other: Mode fosc
+
+list:
+ page:
+ one: "{{ .Count }} pàgina"
+ other: "{{ .Count }} pàgines"
+
+ section:
+ other: Secció
+
+ subsection:
+ one: Subsecció
+ other: Subseccions
+
+article:
+ back:
+ other: Tornar
+
+ tableOfContents:
+ other: Taula de contingut
+
+ relatedContents:
+ other: Continguts relacionats
+
+ lastUpdatedOn:
+ other: Última vegada actualitzat
+
+ readingTime:
+ one: "{{ .Count }} minut a llegir"
+ other: "{{ .Count }} minuts a llegir"
+
+notFound:
+ title:
+ other: No Trobat
+
+ subtitle:
+ other: Aquesta pàgina no existeix
+
+widget:
+ archives:
+ title:
+ other: Arxiu
+
+ more:
+ other: Més
+
+ tagCloud:
+ title:
+ other: Etiquetes
+ categoriesCloud:
+ title:
+ other: Categories
+
+search:
+ title:
+ other: Cerca
+
+ placeholder:
+ other: Tecleja alguna cosa...
+
+ resultTitle:
+ other: "#PAGES_COUNT pàgines en (#TIME_SECONDS segons)"
+
+footer:
+ builtWith:
+ other: Creat amb {{ .Generator }}
+
+ designedBy:
+ other: Tema {{ .Theme }} dissenyat per {{ .DesignedBy }}
diff --git a/i18n/en.yaml b/i18n/en.yaml
index 84cd6c7..f53f302 100644
--- a/i18n/en.yaml
+++ b/i18n/en.yaml
@@ -51,6 +51,9 @@ widget:
tagCloud:
title:
other: Tags
+ categoriesCloud:
+ title:
+ other: Categories
search:
title:
diff --git a/i18n/es.yaml b/i18n/es.yaml
index 9e1d6e1..5f197da 100644
--- a/i18n/es.yaml
+++ b/i18n/es.yaml
@@ -51,6 +51,9 @@ widget:
tagCloud:
title:
other: Etiquetas
+ categoriesCloud:
+ title:
+ other: Categorías
search:
title:
diff --git a/i18n/id.yaml b/i18n/id.yaml
index 2af893a..deeb189 100644
--- a/i18n/id.yaml
+++ b/i18n/id.yaml
@@ -51,6 +51,10 @@ widget:
title:
other: Tag
+ categoriesCloud:
+ title:
+ other: Kategori
+
search:
title:
other: Cari
diff --git a/i18n/ja.yaml b/i18n/ja.yaml
index 3f9978d..ec70d18 100644
--- a/i18n/ja.yaml
+++ b/i18n/ja.yaml
@@ -38,6 +38,10 @@ widget:
title:
other: タグ
+ categoriesCloud:
+ title:
+ other: カテゴリ
+
search:
title:
other: 検索
@@ -47,3 +51,10 @@ search:
resultTitle:
other: "#PAGES_COUNT 件 (#TIME_SECONDS 秒)"
+
+footer:
+ builtWith:
+ other: Built with {{ .Generator }}
+
+ designedBy:
+ other: テーマ {{ .Theme }} は {{ .DesignedBy }} によって設計されています。
diff --git a/i18n/pl.yaml b/i18n/pl.yaml
index f261f86..68c9bc8 100644
--- a/i18n/pl.yaml
+++ b/i18n/pl.yaml
@@ -50,6 +50,10 @@ widget:
tagCloud:
title:
other: Tagi
+
+ categoriesCloud:
+ title:
+ other: Kategorie
search:
title:
diff --git a/i18n/pt-BR.yaml b/i18n/pt-br.yaml
similarity index 100%
rename from i18n/pt-BR.yaml
rename to i18n/pt-br.yaml
diff --git a/i18n/zh-CN.yaml b/i18n/zh-cn.yaml
similarity index 78%
rename from i18n/zh-CN.yaml
rename to i18n/zh-cn.yaml
index 0f08310..3579945 100644
--- a/i18n/zh-CN.yaml
+++ b/i18n/zh-cn.yaml
@@ -38,6 +38,10 @@ widget:
title:
other: 标签云
+ categoriesCloud:
+ title:
+ other: 分类
+
search:
title:
other: 搜索
@@ -47,3 +51,10 @@ search:
resultTitle:
other: "#PAGES_COUNT 个结果 (用时 #TIME_SECONDS 秒)"
+
+footer:
+ builtWith:
+ other: Built with {{ .Generator }}
+
+ designedBy:
+ other: 主题 {{ .Theme }} 由 {{ .DesignedBy }} 设计
diff --git a/i18n/zh-hk.yaml b/i18n/zh-hk.yaml
new file mode 100644
index 0000000..d927bdc
--- /dev/null
+++ b/i18n/zh-hk.yaml
@@ -0,0 +1,73 @@
+toggleMenu:
+ other: 切換選單
+
+darkMode:
+ other: 深色模式
+
+list:
+ page:
+ one: "第 {{ .Count }} 頁"
+ other: "第 {{ .Count }} 頁"
+
+ section:
+ other: Section
+
+ subsection:
+ one: Subsection
+ other: Subsections
+
+article:
+ back:
+ other: 返回
+
+ tableOfContents:
+ other: 目錄
+
+ relatedContents:
+ other: 相關內容
+
+ lastUpdatedOn:
+ other: 上次改過於
+
+ readingTime:
+ one: "需要 {{ .Count }} 分鐘閱讀"
+ other: "需要 {{ .Count }} 分鐘閱讀"
+
+notFound:
+ title:
+ other: Not Found
+
+ subtitle:
+ other: 頁面不存在
+
+widget:
+ archives:
+ title:
+ other: Archives
+
+ more:
+ other: 更多
+
+ tagCloud:
+ title:
+ other: Tags
+ categoriesCloud:
+ title:
+ other: Categories
+
+search:
+ title:
+ other: 搜尋
+
+ placeholder:
+ other: Type 關鍵字...
+
+ resultTitle:
+ other: "#PAGES_COUNT pages (#TIME_SECONDS seconds)"
+
+footer:
+ builtWith:
+ other: Built with {{ .Generator }}
+
+ designedBy:
+ other: 主題 {{ .Theme }} 由 {{ .DesignedBy }} 設計
diff --git a/i18n/zh-TW.yaml b/i18n/zh-tw.yaml
similarity index 100%
rename from i18n/zh-TW.yaml
rename to i18n/zh-tw.yaml
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
index 0325458..0ed5584 100644
--- a/layouts/_default/_markup/render-image.html
+++ b/layouts/_default/_markup/render-image.html
@@ -25,22 +25,17 @@
{{- end -}}
{{- end -}}
-
-
-
-
- {{ with $alt }}
- {{ . | markdownify }}
+ data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
+ data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
{{ end }}
-
\ No newline at end of file
+>
\ No newline at end of file
diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html
index 321aa6d..5d5243c 100644
--- a/layouts/_default/archives.html
+++ b/layouts/_default/archives.html
@@ -1,17 +1,19 @@
{{ define "body-class" }}template-archives{{ end }}
{{ define "main" }}
- {{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}}
- {{- $terms := $taxonomy.Pages -}}
- {{ if $terms }}
-
{{ $taxonomy.Title }}
-
-
- {{ range $terms }}
- {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
- {{ end }}
+
- {{ end }}
+ {{ end }}
+
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 8a5ff95..081277b 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,12 +1,20 @@
-
+
{{- partial "head/head.html" . -}}
{{- block "head" . -}}{{ end }}
{{- partial "head/colorScheme" . -}}
-
+
+ {{/* The container is wider when there's any activated widget */}}
+ {{- $hasWidget := false -}}
+ {{- range .Site.Params.widgets -}}
+ {{- if gt (len .) 0 -}}
+ {{- $hasWidget = true -}}
+ {{- end -}}
+ {{- end -}}
+
{{- block "left-sidebar" . -}}
{{ partial "sidebar/left.html" . }}
{{- end -}}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index a979d27..a50934e 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,46 +1,48 @@
{{ define "main" }}
-
- {{ if eq .Parent (.GetPage "/") }}
- {{ T "list.section" }}
- {{ else }}
- {{ .Parent.Title }}
- {{ end }}
-
-
-
-
-
{{ T "list.page" (len .Pages) }}
- {{ .Title | markdownify }}
- {{ with .Params.description }}
- {{ . }}
+
+
+ {{ if eq .Parent (.GetPage "/") }}
+ {{ T "list.section" }}
+ {{ else }}
+ {{ .Parent.Title }}
{{ end }}
-
+
- {{- $image := partialCached "helper/image" (dict "Context" . "Type" "section") .RelPermalink "section" -}}
- {{ if $image.exists }}
-
- {{ if $image.resource }}
- {{- $Permalink := $image.resource.RelPermalink -}}
- {{- $Width := $image.resource.Width -}}
- {{- $Height := $image.resource.Height -}}
-
- {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
- {{- $thumbnail := $image.resource.Fill "120x120" -}}
- {{- $Permalink = $thumbnail.RelPermalink -}}
- {{- $Width = $thumbnail.Width -}}
- {{- $Height = $thumbnail.Height -}}
- {{- end -}}
-
-

- {{ else }}
-

+
+
+
{{ T "list.page" (len .Pages) }}
+ {{ .Title | markdownify }}
+ {{ with .Params.description }}
+ {{ . }}
{{ end }}
- {{ end }}
-
+
+ {{- $image := partialCached "helper/image" (dict "Context" . "Type" "section") .RelPermalink "section" -}}
+ {{ if $image.exists }}
+
+ {{ if $image.resource }}
+ {{- $Permalink := $image.resource.RelPermalink -}}
+ {{- $Width := $image.resource.Width -}}
+ {{- $Height := $image.resource.Height -}}
+
+ {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- $thumbnail := $image.resource.Fill "120x120" -}}
+ {{- $Permalink = $thumbnail.RelPermalink -}}
+ {{- $Width = $thumbnail.Width -}}
+ {{- $Height = $thumbnail.Height -}}
+ {{- end -}}
+
+

+ {{ else }}
+

+ {{ end }}
+
+ {{ end }}
+
+
{{- $subsections := .Sections -}}
{{- $pages := .Pages | complement $subsections -}}
@@ -53,14 +55,16 @@
{{- end -}}
{{- with $subsections -}}
-
{{ T "list.subsection" (len $subsections) }}
-
-
- {{ range . }}
- {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "section") }}
- {{ end }}
+
+
{{- end -}}
{{/* List only pages that are not a subsection */}}
@@ -77,5 +81,5 @@
{{ end }}
{{ define "right-sidebar" }}
- {{ partialCached "sidebar/right.html" . }}
-{{ end }}
\ No newline at end of file
+ {{ partial "sidebar/right.html" (dict "Context" . "Scope" "homepage") }}
+{{ end }}
diff --git a/layouts/rss.xml b/layouts/_default/rss.xml
similarity index 86%
rename from layouts/rss.xml
rename to layouts/_default/rss.xml
index 178f997..e9f3f1a 100644
--- a/layouts/rss.xml
+++ b/layouts/_default/rss.xml
@@ -1,9 +1,15 @@
-{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
-{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
-{{- $filtered := ($pages | intersect $notHidden) -}}
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := slice -}}
+{{- if or $.IsHome $.IsSection -}}
+{{- $pages = $pctx.RegularPages -}}
+{{- else -}}
+{{- $pages = $pctx.Pages -}}
+{{- end -}}
+{{- $pages := where $pages "Params.hidden" "!=" true -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
-{{- $filtered = $filtered | first $limit -}}
+{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "" | safeHTML }}
@@ -20,7 +26,7 @@
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "" .Permalink .MediaType | safeHTML }}
{{- end -}}
- {{ range $filtered }}
+ {{ range $pages }}
{{- $content := safeHTML (.Summary | html) -}}
{{- if .Site.Params.rssFullContent -}}
{{- $content = safeHTML (.Content | html) -}}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 80e723a..c70df20 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,15 +1,26 @@
{{ define "body-class" }}
- {{ $TOCEnabled := default (default false .Site.Params.article.toc) .Params.toc }}
- {{- .Scratch.Set "hasTOC" (and (ge (len .TableOfContents) 100) $TOCEnabled) -}}
- article-page {{ if (.Scratch.Get "hasTOC") }}has-toc{{ end }}
-{{ end }}
+ article-page
+ {{/*
+ Enable the right sidebar if
+ - Widget different from 'TOC' is enabled
+ - TOC is enabled and not empty
+ */}}
+ {{- $HasWidgetNotTOC := false -}}
+ {{- $TOCWidgetEnabled := false -}}
+ {{- range .Site.Params.widgets.page -}}
+ {{- if ne .type "toc" -}}
+ {{ $HasWidgetNotTOC = true -}}
+ {{- else -}}
+ {{ $TOCWidgetEnabled = true -}}
+ {{- end -}}
+ {{- end -}}
-{{ define "container-class" }}
- {{ if (.Scratch.Get "hasTOC") }}
- extended
- {{ else }}
- on-phone--column {{ if .Site.Params.widgets.enabled }}extended{{ else }}compact{{ end }}
- {{ end }}
+ {{- $TOCManuallyDisabled := eq .Params.toc false -}}
+ {{- $TOCEnabled := and (not $TOCManuallyDisabled) $TOCWidgetEnabled -}}
+ {{- $hasTOC := ge (len .TableOfContents) 100 -}}
+ {{- .Scratch.Set "TOCEnabled" (and $TOCEnabled $hasTOC) -}}
+
+ {{- .Scratch.Set "hasWidget" (or $HasWidgetNotTOC (and $TOCEnabled $hasTOC)) -}}
{{ end }}
{{ define "main" }}
@@ -30,29 +41,6 @@
{{ partialCached "article/components/photoswipe" . }}
{{ end }}
-{{ define "left-sidebar" }}
- {{ if (.Scratch.Get "hasTOC") }}
-
- {{ else }}
- {{ partial "sidebar/left.html" . }}
- {{ end }}
-{{ end }}
-
{{ define "right-sidebar" }}
- {{ if (.Scratch.Get "hasTOC") }}
-
- {{ end }}
+ {{ if .Scratch.Get "hasWidget" }}{{ partial "sidebar/right.html" (dict "Context" . "Scope" "page") }}{{ end}}
{{ end }}
diff --git a/layouts/index.html b/layouts/index.html
index 576faef..0cd0b88 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -15,5 +15,5 @@
{{ end }}
{{ define "right-sidebar" }}
- {{ partial "sidebar/right.html" . }}
+ {{ partial "sidebar/right.html" (dict "Context" . "Scope" "homepage") }}
{{ end }}
\ No newline at end of file
diff --git a/layouts/page/search.html b/layouts/page/search.html
index 935b384..7c424a6 100644
--- a/layouts/page/search.html
+++ b/layouts/page/search.html
@@ -16,8 +16,10 @@
-
-
+
+{{- end -}}
diff --git a/layouts/partials/comments/provider/giscus.html b/layouts/partials/comments/provider/giscus.html
index f36ead9..abe345f 100644
--- a/layouts/partials/comments/provider/giscus.html
+++ b/layouts/partials/comments/provider/giscus.html
@@ -9,41 +9,41 @@
data-reactions-enabled="{{- default 1 .reactionsEnabled -}}"
data-emit-metadata="{{- default 0 .emitMetadata -}}"
data-theme="{{- default `light` .lightTheme -}}"
+ data-lang="{{- default `en` .lang -}}"
crossorigin="anonymous"
async
>
{{- end -}}
-
diff --git a/layouts/partials/comments/provider/twikoo.html b/layouts/partials/comments/provider/twikoo.html
index 4dbf976..7dd3e50 100644
--- a/layouts/partials/comments/provider/twikoo.html
+++ b/layouts/partials/comments/provider/twikoo.html
@@ -1,4 +1,4 @@
-
+