-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update docs for multi-language chore: add custom css support chore: add social icons
- Loading branch information
Showing
12 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: "Multi-language" | ||
weight: 1 | ||
--- | ||
|
||
Hextra supports creating site with multiple languages using Hugo's [multilingual mode](https://gohugo.io/content-management/multilingual/). | ||
|
||
## Enable Multi-language | ||
|
||
To make our site multi-language, we need to tell Hugo the supported languages. We need to add to the site configuration file: | ||
|
||
```yaml {filename="hugo.yaml"} | ||
defaultContentLanguage: en | ||
languages: | ||
en: | ||
languageName: English | ||
weight: 1 | ||
fr: | ||
languageName: Français | ||
weight: 2 | ||
ja: | ||
languageName: 日本語 | ||
weight: 3 | ||
``` | ||
## Manage Translations by Filename | ||
Hugo supports managing translations by filename. For example, if we have a file `content/docs/_index.md` in English, we can create a file `content/docs/_index.fr.md` for French translation. | ||
|
||
{{< filetree/container >}} | ||
{{< filetree/folder name="content" >}} | ||
{{< filetree/folder name="docs" state="open" >}} | ||
{{< filetree/file name="_index.md" >}} | ||
{{< filetree/file name="_index.fr.md" >}} | ||
{{< filetree/file name="_index.ja.md" >}} | ||
{{< /filetree/folder >}} | ||
{{< /filetree/folder >}} | ||
{{< /filetree/container >}} | ||
|
||
Note: Hugo also supports [Translation by content directory](https://gohugo.io/content-management/multilingual/#translation-by-content-directory). | ||
|
||
## Translate Menu Items | ||
|
||
To translate menu items in the navigation bar, we need to set the `identifier` field: | ||
|
||
```yaml {filename="hugo.yaml"} | ||
menu: | ||
main: | ||
- identifier: documentation | ||
name: Documentation | ||
pageRef: /docs | ||
weight: 1 | ||
- identifier: blog | ||
name: Blog | ||
pageRef: /blog | ||
weight: 2 | ||
``` | ||
|
||
and translate them in the corresponding i18n file: | ||
|
||
```yaml {filename="i18n/fr.yaml"} | ||
documentation: Documentation | ||
blog: Blog | ||
``` | ||
|
||
## Read More | ||
|
||
- [Hugo Multilingual Mode](https://gohugo.io/content-management/multilingual/) | ||
- [Hugo Multilingual Part 1: Content translation](https://www.regisphilibert.com/blog/2018/08/hugo-multilingual-part-1-managing-content-translation/) | ||
- [Hugo Multilingual Part 2: Strings localization](https://www.regisphilibert.com/blog/2018/08/hugo-multilingual-part-2-i18n-string-localization/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
documentation: "ドキュメンテーション" | ||
blog: "ブログ" | ||
about: "このサイトについて" | ||
|
||
search_placeholder: "検索ドキュメント..." | ||
|
||
article: | ||
on_this_page: "このページでは" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
<img class="block dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoWidth }}" width="{{ $logoHeight }}" /> | ||
<img class="hidden dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoWidth }}" width="{{ $logoHeight }}" /> | ||
{{- if .Site.Params.navbar.displayTitle -}} | ||
<span class="mx-2 font-extrabold hidden md:inline select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span> | ||
<span class="mx-2 font-extrabold inline select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span> | ||
{{- end -}} | ||
</a> | ||
|
||
|
@@ -25,26 +25,26 @@ | |
{{- $external := strings.HasPrefix .URL "http" -}} | ||
{{/* Display icon menu item */}} | ||
{{- if .Params.icon -}} | ||
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ .URL | safeURL }}"> | ||
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ .URL | relLangURL }}"> | ||
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") -}} | ||
<span class="sr-only">{{ .Name }}</span> | ||
<span class="sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span> | ||
</a> | ||
{{- else -}} | ||
{{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}} | ||
{{- $activeClass := cond $active "font-medium" "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" -}} | ||
<a | ||
href="{{ .URL | safeURL }}" | ||
href="{{ .URL | relLangURL }}" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
imfing
Author
Owner
|
||
{{ if $external }}target="_blank" rel="noreferer"{{ end }} | ||
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block {{ $activeClass }}" | ||
> | ||
<span class="text-center">{{ .Name }}</span> | ||
<span class="text-center">{{ or (T .Identifier) .Name | safeHTML }}</span> | ||
</a> | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
|
||
<button type="button" aria-label="Menu" class="hamburger-menu ml-auto -mr-2 rounded p-2 active:bg-gray-400/20 md:hidden"> | ||
<button type="button" aria-label="Menu" class="hamburger-menu -mr-2 rounded p-2 active:bg-gray-400/20 md:hidden"> | ||
{{- partial "utils/icon.html" (dict "name" "hamburger-menu" "attributes" "height=24") -}} | ||
</button> | ||
</nav> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here should not be relative url for external urls. Maybe need to revert back to
safeURL
.