Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/reuixiy/hugo-theme-meme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--README.zh-cn.md2
-rw-r--r--assets/scss/components/_multilingual.scss4
-rw-r--r--config-examples/en/config.toml (renamed from config-examples/en-us/config.toml)4
-rw-r--r--config-examples/zh-cn/config.toml2
-rw-r--r--data/Flags.toml2
l---------exampleSite/config.toml2
-rw-r--r--i18n/de.toml (renamed from i18n/de-de.toml)3
-rw-r--r--i18n/en.toml (renamed from i18n/en-us.toml)3
-rw-r--r--i18n/zh.toml (renamed from i18n/zh-cn.toml)3
-rw-r--r--layouts/partials/components/multilingual.html6
-rw-r--r--layouts/partials/utils/open-graph.html20
12 files changed, 17 insertions, 36 deletions
diff --git a/README.md b/README.md
index 2110840..5cbad1e 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ How to update MemE to the latest version?
### Blogging
-1. Replace `config.toml` with [config.toml](https://github.com/reuixiy/hugo-theme-meme/blob/master/config-examples/en-us/config.toml).
+1. Replace `config.toml` with [config examples](https://github.com/reuixiy/hugo-theme-meme/blob/master/config-examples/en/config.toml).
2. Create a new post and the about page:
```sh
diff --git a/README.zh-cn.md b/README.zh-cn.md
index b86c877..fe2a8ff 100644
--- a/README.zh-cn.md
+++ b/README.zh-cn.md
@@ -44,7 +44,7 @@ https://gohugo.io/getting-started/quick-start/
### 开始写作
-1. 将 `config.toml` 替换为 [config.toml](https://github.com/reuixiy/hugo-theme-meme/blob/master/config-examples/zh-cn/config.toml)。
+1. 将 `config.toml` 替换为[示例配置](https://github.com/reuixiy/hugo-theme-meme/blob/master/config-examples/zh-cn/config.toml)。
2. 新建一篇文章和一个关于页面:
```sh
diff --git a/assets/scss/components/_multilingual.scss b/assets/scss/components/_multilingual.scss
index c6d3ddc..86c7ff8 100644
--- a/assets/scss/components/_multilingual.scss
+++ b/assets/scss/components/_multilingual.scss
@@ -1,6 +1,7 @@
#lang-switcher {
position: relative;
z-index: 4;
+ color: var(--color-contrast-medium);
}
#langs {
@@ -9,6 +10,9 @@
margin: 0;
padding: 0;
list-style: none;
+ li {
+ width: max-content;
+ }
}
@if ($headerLayoutFlex) {
diff --git a/config-examples/en-us/config.toml b/config-examples/en/config.toml
index 0e8b50d..79d056d 100644
--- a/config-examples/en-us/config.toml
+++ b/config-examples/en/config.toml
@@ -3,7 +3,7 @@
baseURL = "https://example.com/"
title = "Hugo Theme MemE"
-languageCode = "en-US"
+languageCode = "en"
hasCJKLanguage = false
# Copyright information (Markdown supported)
copyright = "[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)"
@@ -15,7 +15,7 @@ theme = "meme"
newContentEditor = ""
# i18n
-defaultContentLanguage = "en-us"
+defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
# Pluralize titles in lists?
diff --git a/config-examples/zh-cn/config.toml b/config-examples/zh-cn/config.toml
index 852e8bb..216312f 100644
--- a/config-examples/zh-cn/config.toml
+++ b/config-examples/zh-cn/config.toml
@@ -15,7 +15,7 @@ theme = "meme"
newContentEditor = ""
# i18n
-defaultContentLanguage = "zh-cn"
+defaultContentLanguage = "zh"
defaultContentLanguageInSubdir = false
# 是否复数化列表页面的标题
diff --git a/data/Flags.toml b/data/Flags.toml
deleted file mode 100644
index a5d413c..0000000
--- a/data/Flags.toml
+++ /dev/null
@@ -1,2 +0,0 @@
-en-us = "🇺🇸"
-zh-cn = "🇨🇳" \ No newline at end of file
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 93e4df6..21fae3d 120000
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -1 +1 @@
-../config-examples/en-us/config.toml \ No newline at end of file
+../config-examples/en/config.toml \ No newline at end of file
diff --git a/i18n/de-de.toml b/i18n/de.toml
index 068a7d7..e941c48 100644
--- a/i18n/de-de.toml
+++ b/i18n/de.toml
@@ -1,6 +1,3 @@
-[flag]
-other = "de"
-
[ellipsis]
other = "..."
diff --git a/i18n/en-us.toml b/i18n/en.toml
index d3daffc..705e28f 100644
--- a/i18n/en-us.toml
+++ b/i18n/en.toml
@@ -1,6 +1,3 @@
-[flag]
-other = "🇺🇸"
-
[ellipsis]
other = "..."
diff --git a/i18n/zh-cn.toml b/i18n/zh.toml
index 682eac8..cbaa645 100644
--- a/i18n/zh-cn.toml
+++ b/i18n/zh.toml
@@ -1,6 +1,3 @@
-[flag]
-other = "🇨🇳"
-
[ellipsis]
other = "……"
diff --git a/layouts/partials/components/multilingual.html b/layouts/partials/components/multilingual.html
index c52256a..5243447 100644
--- a/layouts/partials/components/multilingual.html
+++ b/layouts/partials/components/multilingual.html
@@ -13,11 +13,11 @@
{{- end -}}
{{- $hide := .Scratch.Get "hide" -}}
<div id="lang-switcher"{{ if $hide }} data-hide="true"{{ end }}>
- {{ i18n "flag" }}
+ {{ .Site.Language.LanguageName }}
{{ if .IsTranslated }}
<ul id="langs">
{{ range .Translations }}
- <li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ index $.Site.Data.Flags .Lang }}</a></li>
+ <li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
</ul>
{{ else }}
@@ -25,7 +25,7 @@
<ul id="langs">
{{ range .Site.Languages }}
{{ if ne $.Site.Language.Lang .Lang }}
- <li><a rel="alternate" href="{{ .Lang | relURL }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ index $.Site.Data.Flags .Lang }}</a></li>
+ <li><a rel="alternate" href="{{ .Lang | relURL }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ .LanguageName }}</a></li>
{{ end }}
{{ end }}
</ul>
diff --git a/layouts/partials/utils/open-graph.html b/layouts/partials/utils/open-graph.html
index a9e0dd8..c37973e 100644
--- a/layouts/partials/utils/open-graph.html
+++ b/layouts/partials/utils/open-graph.html
@@ -18,27 +18,15 @@
<!-- Images -->
{{- partial "utils/images.html" $Deliver -}}
{{- $images := $Deliver.Scratch.Get "images" -}}
-<!-- languageCode -->
-{{- if $Deliver.Site.IsMultiLingual -}}
- {{- $languageCode := readFile "config.toml" | findRE `languageCode = "([^"]+)` | uniq -}}
- {{- with $languageCode -}}
- {{- $Deliver.Scratch.Delete "languageCode" -}}
- {{- range . -}}
- {{- $languageCode := replaceRE `languageCode = "([^"]+)` `$1` . -}}
- {{- $Deliver.Scratch.Add "languageCode" (slice $languageCode) -}}
- {{- end -}}
- {{- end -}}
-{{- end -}}
-{{- $languageCode := $Deliver.Scratch.Get "languageCode" -}}
<meta property="og:title" content="{{ $rawTitle }}" />
<meta property="og:description" content="{{ $description }}" />
<meta property="og:url" content="{{ $Deliver.Permalink }}" />
<meta property="og:site_name" content="{{ $Deliver.Site.Title }}" />
-<meta property="og:locale" content="{{ $Deliver.Site.LanguageCode }}" />
-{{- if $Deliver.Site.IsMultiLingual -}}
- {{- range $languageCode -}}
- {{ if ne . $Deliver.Site.LanguageCode }}
+<meta property="og:locale" content="{{ $Deliver.Site.Language.Lang }}" />
+{{- if and $Deliver.Site.IsMultiLingual $Deliver.IsTranslated -}}
+ {{- range $Deliver.Site.Languages -}}
+ {{ if ne .Lang $Deliver.Site.Language.Lang }}
<meta property="og:locale:alternate" content="{{ . }}" />
{{ end }}
{{- end -}}