mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-06-19 04:23:30 +08:00
add i18n widget
This commit is contained in:
parent
ca9b873f37
commit
ae5a0be743
8
assets/icons/docs.svg
Normal file
8
assets/icons/docs.svg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-file-text" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
||||||
|
<path d="M14 3v4a1 1 0 0 0 1 1h4" />
|
||||||
|
<path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" />
|
||||||
|
<line x1="9" y1="9" x2="10" y2="9" />
|
||||||
|
<line x1="9" y1="13" x2="15" y2="13" />
|
||||||
|
<line x1="9" y1="17" x2="15" y2="17" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 538 B |
8
assets/icons/i18n.svg
Normal file
8
assets/icons/i18n.svg
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-language-hiragana" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
||||||
|
<path d="M4 5h7" />
|
||||||
|
<path d="M7 4c0 4.846 0 7 .5 8" />
|
||||||
|
<path d="M10 8.5c0 2.286 -2 4.5 -3.5 4.5s-2.5 -1.135 -2.5 -2c0 -2 1 -3 3 -3s5 .57 5 2.857c0 1.524 -.667 2.571 -2 3.143" />
|
||||||
|
<path d="M12 20l4 -9l4 9" />
|
||||||
|
<path d="M19.1 18h-6.2" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 541 B |
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -140,8 +140,10 @@ params:
|
|||||||
- type: tag-cloud
|
- type: tag-cloud
|
||||||
params:
|
params:
|
||||||
limit: 10
|
limit: 10
|
||||||
|
- type: i18n-nav
|
||||||
page:
|
page:
|
||||||
- type: toc
|
- type: toc
|
||||||
|
- type: i18n-nav
|
||||||
|
|
||||||
opengraph:
|
opengraph:
|
||||||
twitter:
|
twitter:
|
||||||
@ -184,6 +186,15 @@ menu:
|
|||||||
newTab: false
|
newTab: false
|
||||||
icon: home
|
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:
|
social:
|
||||||
- identifier: github
|
- identifier: github
|
||||||
name: GitHub
|
name: GitHub
|
||||||
@ -232,6 +243,25 @@ languages:
|
|||||||
weight: 1
|
weight: 1
|
||||||
languageCode: en
|
languageCode: en
|
||||||
zh-cn:
|
zh-cn:
|
||||||
languageName: 日本語
|
languageName: 简体中文
|
||||||
weight: 2
|
weight: 2
|
||||||
languageCode: zh-cn
|
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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: About
|
title: 关于
|
||||||
description: Hugo, the world's fastest framework for building websites
|
description: Hugo, the world's fastest framework for building websites
|
||||||
date: '2019-02-28'
|
date: '2019-02-28'
|
||||||
aliases:
|
aliases:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "Archives"
|
title: "归档"
|
||||||
date: 2019-05-28
|
date: 2019-05-28
|
||||||
layout: "archives"
|
layout: "archives"
|
||||||
slug: "archives"
|
slug: "archives"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Links
|
title: 链接
|
||||||
links:
|
links:
|
||||||
- title: GitHub
|
- title: GitHub
|
||||||
description: GitHub is the world's largest software development platform.
|
description: GitHub is the world's largest software development platform.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "Search"
|
title: "搜索"
|
||||||
slug: "search"
|
slug: "search"
|
||||||
layout: "search"
|
layout: "search"
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -52,6 +52,10 @@ widget:
|
|||||||
title:
|
title:
|
||||||
other: Tags
|
other: Tags
|
||||||
|
|
||||||
|
i18n-nav:
|
||||||
|
title:
|
||||||
|
other: multi language
|
||||||
|
|
||||||
search:
|
search:
|
||||||
title:
|
title:
|
||||||
other: Search
|
other: Search
|
||||||
|
@ -38,6 +38,10 @@ widget:
|
|||||||
title:
|
title:
|
||||||
other: 标签云
|
other: 标签云
|
||||||
|
|
||||||
|
i18n-nav:
|
||||||
|
title:
|
||||||
|
other: 多语言
|
||||||
|
|
||||||
search:
|
search:
|
||||||
title:
|
title:
|
||||||
other: 搜索
|
other: 搜索
|
||||||
|
22
layouts/partials/widget/i18n-nav.html
Normal file
22
layouts/partials/widget/i18n-nav.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{{- $context := .Context -}}
|
||||||
|
|
||||||
|
{{ if ne (len $context.Translations) "0" }}
|
||||||
|
<section class="widget i18n">
|
||||||
|
<div class="widget-icon">
|
||||||
|
{{ partial "helper/icon" "i18n" }}
|
||||||
|
</div>
|
||||||
|
<h2 class="widget-title section-title">{{ T "widget.i18n-nav.title" }}</h2>
|
||||||
|
|
||||||
|
<div class="i18n--list">
|
||||||
|
{{ range $context.Translations }}
|
||||||
|
<div class="i18n--node">
|
||||||
|
<a href="{{ .RelPermalink }}">
|
||||||
|
<span class="year">{{ .Language.LanguageName }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue
Block a user