diff --git a/assets/icons/docs.svg b/assets/icons/docs.svg new file mode 100644 index 0000000..fbe9f52 --- /dev/null +++ b/assets/icons/docs.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/icons/i18n.svg b/assets/icons/i18n.svg new file mode 100644 index 0000000..d5bdc49 --- /dev/null +++ b/assets/icons/i18n.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/assets/scss/partials/widgets.scss b/assets/scss/partials/widgets.scss index 33a02dd..5287ae6 100644 --- a/assets/scss/partials/widgets.scss +++ b/assets/scss/partials/widgets.scss @@ -64,3 +64,26 @@ } } } + +/* i18n nav widget */ +.widget.i18n { + .i18n--list { + border-radius: var(--card-border-radius); + box-shadow: var(--shadow-l1); + background-color: var(--card-background); + } + + .i18n--node { + a { + font-size: 1.4rem; + padding: 18px 25px; + display: flex; + + span { + flex: 1; + color: var(--card-text-color-main); + font-weight: bold; + } + } + } +} diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 80c95e4..aa54803 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -140,8 +140,10 @@ params: - type: tag-cloud params: limit: 10 + - type: i18n-nav page: - type: toc + - type: i18n-nav opengraph: twitter: @@ -184,6 +186,15 @@ menu: newTab: false icon: home + - identifier: docs + name: Docs + url: https://docs.stack.jimmycai.com/ + weight: -40 + params: + ### For demonstration purpose, the home link will be open in a new tab + newTab: true + icon: docs + social: - identifier: github name: GitHub @@ -232,6 +243,25 @@ languages: weight: 1 languageCode: en zh-cn: - languageName: 日本語 + languageName: 简体中文 weight: 2 languageCode: zh-cn + menu: + main: + - identifier: home + name: 主页 + url: / + weight: -100 + params: + ### For demonstration purpose, the home link will be open in a new tab + newTab: false + icon: home + + - identifier: docs + name: 文档 + url: https://docs.stack.jimmycai.com/ + weight: -40 + params: + ### For demonstration purpose, the home link will be open in a new tab + newTab: true + icon: docs diff --git a/exampleSite/content/page/about/index.zh-cn.md b/exampleSite/content/page/about/index.zh-cn.md index 494cb46..06b7937 100644 --- a/exampleSite/content/page/about/index.zh-cn.md +++ b/exampleSite/content/page/about/index.zh-cn.md @@ -1,5 +1,5 @@ --- -title: About +title: 关于 description: Hugo, the world's fastest framework for building websites date: '2019-02-28' aliases: diff --git a/exampleSite/content/page/archives/index.zh-cn.md b/exampleSite/content/page/archives/index.zh-cn.md index 2862deb..e3086a7 100644 --- a/exampleSite/content/page/archives/index.zh-cn.md +++ b/exampleSite/content/page/archives/index.zh-cn.md @@ -1,5 +1,5 @@ --- -title: "Archives" +title: "归档" date: 2019-05-28 layout: "archives" slug: "archives" diff --git a/exampleSite/content/page/links/index.zh-cn.md b/exampleSite/content/page/links/index.zh-cn.md index 9e29bf3..bb9e5ba 100644 --- a/exampleSite/content/page/links/index.zh-cn.md +++ b/exampleSite/content/page/links/index.zh-cn.md @@ -1,5 +1,5 @@ --- -title: Links +title: 链接 links: - title: GitHub description: GitHub is the world's largest software development platform. diff --git a/exampleSite/content/page/search/index.zh-cn.md b/exampleSite/content/page/search/index.zh-cn.md index b2a5943..87e8c04 100644 --- a/exampleSite/content/page/search/index.zh-cn.md +++ b/exampleSite/content/page/search/index.zh-cn.md @@ -1,5 +1,5 @@ --- -title: "Search" +title: "搜索" slug: "search" layout: "search" outputs: diff --git a/i18n/en.yaml b/i18n/en.yaml index 0197d89..eb5629a 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -52,6 +52,10 @@ widget: title: other: Tags + i18n-nav: + title: + other: multi language + search: title: other: Search diff --git a/i18n/zh-CN.yaml b/i18n/zh-CN.yaml index 0f08310..b1f0421 100644 --- a/i18n/zh-CN.yaml +++ b/i18n/zh-CN.yaml @@ -38,6 +38,10 @@ widget: title: other: 标签云 + i18n-nav: + title: + other: 多语言 + search: title: other: 搜索 diff --git a/layouts/partials/sidebar/right.html b/layouts/partials/sidebar/right.html index d2a6ae8..f19659a 100644 --- a/layouts/partials/sidebar/right.html +++ b/layouts/partials/sidebar/right.html @@ -10,4 +10,4 @@ {{ end }} {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html index 1f2abc5..b0d8c2f 100644 --- a/layouts/partials/widget/archives.html +++ b/layouts/partials/widget/archives.html @@ -32,4 +32,4 @@ {{- else -}} {{- warnf "Archives page not found. Create a page with layout: archives." -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/layouts/partials/widget/i18n-nav.html b/layouts/partials/widget/i18n-nav.html new file mode 100644 index 0000000..fb3c0bf --- /dev/null +++ b/layouts/partials/widget/i18n-nav.html @@ -0,0 +1,22 @@ +{{- $context := .Context -}} + +{{ if ne (len $context.Translations) "0" }} +
+
+ {{ partial "helper/icon" "i18n" }} +
+

{{ T "widget.i18n-nav.title" }}

+ +
+ {{ range $context.Translations }} + + {{ end }} + +
+ +
+{{ end }} diff --git a/layouts/partials/widget/search.html b/layouts/partials/widget/search.html index 7b0fc73..626dcce 100644 --- a/layouts/partials/widget/search.html +++ b/layouts/partials/widget/search.html @@ -13,4 +13,4 @@ {{- else -}} {{- warnf "Search page not found. Create a page with layout: search." -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/layouts/partials/widget/tag-cloud.html b/layouts/partials/widget/tag-cloud.html index e64e5e2..4fcb190 100644 --- a/layouts/partials/widget/tag-cloud.html +++ b/layouts/partials/widget/tag-cloud.html @@ -13,4 +13,4 @@ {{ end }} - \ No newline at end of file + diff --git a/layouts/partials/widget/toc.html b/layouts/partials/widget/toc.html index e311de3..5c67e96 100644 --- a/layouts/partials/widget/toc.html +++ b/layouts/partials/widget/toc.html @@ -9,4 +9,4 @@ {{ .Context.TableOfContents }} -{{ end }} \ No newline at end of file +{{ end }}