feat(article): add link to translated content (#511)
This commit is contained in:
parent
26fb06951b
commit
b3b8fa73ef
10
assets/icons/language.svg
Normal file
10
assets/icons/language.svg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-language" 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="M9 3v2c0 4.418 -2.239 8 -5 8" />
|
||||||
|
<path d="M5 9c-.003 2.144 2.952 3.908 6.7 4" />
|
||||||
|
<path d="M12 20l4 -9l4 9" />
|
||||||
|
<path d="M19.1 18h-6.2" />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 467 B |
@ -91,7 +91,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-time {
|
.article-time,
|
||||||
|
.article-translations {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: var(--card-text-color-tertiary);
|
color: var(--card-text-color-tertiary);
|
||||||
@ -101,19 +102,21 @@
|
|||||||
|
|
||||||
svg {
|
svg {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: 15px;
|
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
stroke-width: 1.33;
|
stroke-width: 1.33;
|
||||||
}
|
}
|
||||||
|
|
||||||
time {
|
time,
|
||||||
|
a {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
|
color: var(--card-text-color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,16 @@ theme: hugo-theme-stack
|
|||||||
paginate: 5
|
paginate: 5
|
||||||
title: Example Site
|
title: Example Site
|
||||||
|
|
||||||
|
languages:
|
||||||
|
en:
|
||||||
|
languageName: English
|
||||||
|
title: Example Site
|
||||||
|
weight: 1
|
||||||
|
cn:
|
||||||
|
languageName: 中文
|
||||||
|
title: 演示站点
|
||||||
|
weight: 2
|
||||||
|
|
||||||
# Change it to your Disqus shortname before using
|
# Change it to your Disqus shortname before using
|
||||||
disqusShortname: hugo-theme-stack
|
disqusShortname: hugo-theme-stack
|
||||||
|
|
||||||
|
5
exampleSite/content/page/about/index.cn.md
Normal file
5
exampleSite/content/page/about/index.cn.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: 关于
|
||||||
|
---
|
||||||
|
|
||||||
|
This is a test page for i18n support.
|
@ -42,4 +42,15 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</footer>
|
</footer>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .IsTranslated }}
|
||||||
|
<footer class="article-translations">
|
||||||
|
{{ partial "helper/icon" "language" }}
|
||||||
|
<div>
|
||||||
|
{{ range .Translations }}
|
||||||
|
<a href="{{ .Permalink }}" class="link">{{ .Language.LanguageName }}</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user