diff --git a/README.md b/README.md index 0e6caa2..1c59619 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ > Card-style Hugo theme designed for bloggers. +## Quickstart + +Use this template: [CaiJimmy/hugo-theme-stack-starter](https://github.com/CaiJimmy/hugo-theme-stack-starter) + ## Demo [Example Site](https://demo.stack.jimmycai.com/) @@ -28,6 +32,7 @@ Stack is a simple card-style Hugo theme designed for bloggers, some of its featu - Properly cropped thumbnails - Subsection support - Table of contents +- Multilingual mode and RTL support ## Requirements diff --git a/assets/scss/partials/layout/article.scss b/assets/scss/partials/layout/article.scss index 36f326a..eb58e77 100644 --- a/assets/scss/partials/layout/article.scss +++ b/assets/scss/partials/layout/article.scss @@ -77,47 +77,6 @@ } } -#article-toolbar { - display: flex; - align-items: center; - margin: 20px 0; - - @include respond(md) { - display: none; - } - - .back-home { - background: var(--card-background); - border-radius: var(--tag-border-radius); - color: var(--card-text-color-tertiary); - margin-right: 30px; - display: inline-flex; - align-items: center; - font-size: 1.4rem; - text-transform: uppercase; - padding: 10px 20px 10px 15px; - - transition: box-shadow 0.3s ease; - - box-shadow: var(--shadow-l1); - - &:hover { - box-shadow: var(--shadow-l2); - } - - svg { - margin-right: 5px; - width: 20px; - height: 20px; - } - - span { - font-weight: 500; - white-space: nowrap; - } - } -} - .widget--toc { background-color: var(--card-background); border-radius: var(--card-border-radius); diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 84585b4..ea576c2 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -9,7 +9,7 @@ languages: languageName: English title: Example Site weight: 1 - cn: + zh-cn: languageName: 中文 title: 演示站点 weight: 2 @@ -26,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, ar +# 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] diff --git a/exampleSite/content/_index.cn.md b/exampleSite/content/_index.zh-cn.md similarity index 100% rename from exampleSite/content/_index.cn.md rename to exampleSite/content/_index.zh-cn.md diff --git a/exampleSite/content/page/about/index.cn.md b/exampleSite/content/page/about/index.cn.md deleted file mode 100644 index 060c006..0000000 --- a/exampleSite/content/page/about/index.cn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: 关于 ---- - -This is a test page for i18n support. \ 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.cn.md b/exampleSite/content/post/chinese-test/index.zh-cn.md similarity index 100% rename from exampleSite/content/post/chinese-test/index.cn.md rename to exampleSite/content/post/chinese-test/index.zh-cn.md diff --git a/go.mod b/go.mod index 776617e..63df635 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/CaiJimmy/hugo-theme-stack/v3 -go 1.12 +go 1.17 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/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/baseof.html b/layouts/_default/baseof.html index 98cc815..081277b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -6,7 +6,14 @@ {{- partial "head/colorScheme" . -}} - {{- $hasWidget := default (gt (len .Site.Params.widgets.homepage) 0) (.Scratch.Get "hasWidget") -}} + + {{/* 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" . }} 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/partials/footer/footer.html b/layouts/partials/footer/footer.html index 86222eb..b9ab61a 100644 --- a/layouts/partials/footer/footer.html +++ b/layouts/partials/footer/footer.html @@ -1,4 +1,4 @@ -{{- $ThemeVersion := "3.9.0" -}} +{{- $ThemeVersion := "3.10.0" -}}