feat: add multilingual mode support (#241)
BREAKING CHANGE: Layout file renamed ´layouts/partials/page-footer.html → layouts/partials/menu-nextprev.html`. If you use overrides, you might need to change the filenames as well.
@ -29,3 +29,4 @@ KaTeX
|
|||||||
katex
|
katex
|
||||||
Theming
|
Theming
|
||||||
Favicon[s]?
|
Favicon[s]?
|
||||||
|
UI
|
||||||
|
4
.gitignore
vendored
@ -7,8 +7,12 @@
|
|||||||
/lhci_reports/
|
/lhci_reports/
|
||||||
/exampleSite/themes/
|
/exampleSite/themes/
|
||||||
/exampleSite/public/
|
/exampleSite/public/
|
||||||
|
/exampleSite/config/development/
|
||||||
CHANGELOG.md
|
CHANGELOG.md
|
||||||
|
|
||||||
|
# translation envs
|
||||||
|
exampleSite/content/de
|
||||||
|
|
||||||
# auto-generated files
|
# auto-generated files
|
||||||
/data/
|
/data/
|
||||||
/static/
|
/static/
|
||||||
|
@ -2,11 +2,14 @@
|
|||||||
baseURL: https://geekdocs.de/
|
baseURL: https://geekdocs.de/
|
||||||
title: Geekdocs
|
title: Geekdocs
|
||||||
theme: hugo-geekdoc
|
theme: hugo-geekdoc
|
||||||
|
|
||||||
pygmentsUseClasses: true
|
pygmentsUseClasses: true
|
||||||
pygmentsCodeFences: true
|
pygmentsCodeFences: true
|
||||||
timeout: 180000
|
timeout: 180000
|
||||||
pluralizeListTitles: false
|
pluralizeListTitles: false
|
||||||
|
|
||||||
|
defaultContentLanguage: en
|
||||||
|
|
||||||
disablePathToLower: true
|
disablePathToLower: true
|
||||||
enableGitInfo: true
|
enableGitInfo: true
|
||||||
|
|
||||||
@ -34,19 +37,3 @@ outputs:
|
|||||||
- HTML
|
- HTML
|
||||||
term:
|
term:
|
||||||
- HTML
|
- HTML
|
||||||
|
|
||||||
params:
|
|
||||||
geekdocToC: 3
|
|
||||||
geekdocTagsToMenu: true
|
|
||||||
|
|
||||||
geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
|
|
||||||
geekdocEditPath: edit/main/exampleSite/content
|
|
||||||
|
|
||||||
geekdocSearch: true
|
|
||||||
geekdocSearchShowParent: true
|
|
||||||
|
|
||||||
geekdocLegalNotice: https://thegeeklab.de/legal-notice/#contact-information
|
|
||||||
geekdocPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy
|
|
||||||
|
|
||||||
geekdocImageLazyLoading: true
|
|
||||||
geekdocDarkModeDim: true
|
|
5
exampleSite/config/_default/languages.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
en:
|
||||||
|
languageName: "English"
|
||||||
|
contentDir: "content/en"
|
||||||
|
weight: 10
|
15
exampleSite/config/_default/params.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
geekdocToC: 3
|
||||||
|
geekdocTagsToMenu: true
|
||||||
|
|
||||||
|
geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
|
||||||
|
geekdocEditPath: edit/main/exampleSite/content
|
||||||
|
|
||||||
|
geekdocSearch: true
|
||||||
|
geekdocSearchShowParent: true
|
||||||
|
|
||||||
|
geekdocLegalNotice: https://thegeeklab.de/legal-notice/#contact-information
|
||||||
|
geekdocPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy
|
||||||
|
|
||||||
|
geekdocImageLazyLoading: true
|
||||||
|
geekdocDarkModeDim: true
|
Before Width: | Height: | Size: 462 KiB After Width: | Height: | Size: 462 KiB |
78
exampleSite/content/en/features/multilingual/_index.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
title: Multilingual
|
||||||
|
resources:
|
||||||
|
- name: translation-available
|
||||||
|
src: images/translation-available.png
|
||||||
|
title: ""
|
||||||
|
---
|
||||||
|
|
||||||
|
{{< toc >}}
|
||||||
|
|
||||||
|
Hugo supports the creation of websites with multiple languages. In this post we will explain how to get configure Multilingual Mode with this theme.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Languages
|
||||||
|
|
||||||
|
You need to set a default language and configure at least two different languages used by your site to your configuration file at `config.toml`:
|
||||||
|
|
||||||
|
```Toml
|
||||||
|
defaultContentLanguage = "en"
|
||||||
|
|
||||||
|
[languages.en]
|
||||||
|
languageName = "English"
|
||||||
|
contentDir = "content/en"
|
||||||
|
weight = 10
|
||||||
|
|
||||||
|
[languages.de]
|
||||||
|
languageName = "German"
|
||||||
|
contentDir = "content/de"
|
||||||
|
weight = 20
|
||||||
|
```
|
||||||
|
|
||||||
|
### Translation Strings
|
||||||
|
|
||||||
|
To customize translation strings used by the theme you can create a file `i18n/<languagecode>.toml` for every language you want to use e.g. `i18n/en.toml`. You can lookup all used strings in the [default](https://github.com/thegeeklab/hugo-geekdoc/blob/main/i18n/en.yaml) translation file.
|
||||||
|
|
||||||
|
### Menus
|
||||||
|
|
||||||
|
For the [Bundle Menu](/usage/menus/#bundle-menu) as well as for the [Extra Header Menu](/usage/menus/#extra-header-menu) you can translate the name within the data file of the menu:
|
||||||
|
|
||||||
|
```YAML
|
||||||
|
---
|
||||||
|
more:
|
||||||
|
# If `name` is a text, this text will be used as name for each language.
|
||||||
|
- name: News
|
||||||
|
ref: "/#"
|
||||||
|
icon: "gdoc_notification"
|
||||||
|
# To translate the name you can add a sub-item per language. Important: If you miss a language key
|
||||||
|
# that is configured in the languages list of your `config.toml` the name will be empty for this language!
|
||||||
|
- name:
|
||||||
|
en: Releases
|
||||||
|
de: Veröffentlichung
|
||||||
|
ref: "https://github.com/thegeeklab/hugo-geekdoc/releases"
|
||||||
|
external: true
|
||||||
|
icon: "gdoc_download"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add Content
|
||||||
|
|
||||||
|
To translate your content you need to create a directory `content/<languagecode>/` for each language you want to use e.g. `content/en/`. This language directories will hold the translated pages for the particular language.
|
||||||
|
|
||||||
|
## Switch Content
|
||||||
|
|
||||||
|
If you have configured at least two different languages, the language switcher will be enabled in the UI automatically. The switcher is as part of the header menu and displayed on all pages.
|
||||||
|
|
||||||
|
{{< columns >}}
|
||||||
|
|
||||||
|
[![Beach Color Palette](images/translation-available.png)](images/translation-available.png)
|
||||||
|
|
||||||
|
On pages for which a translation is available it will be displayed in the selection list and links to the translated page.
|
||||||
|
|
||||||
|
<--->
|
||||||
|
|
||||||
|
[![Beach Color Palette](images/translation-not-available.png)](images/translation-not-available.png)
|
||||||
|
|
||||||
|
Pages without a translation will be displayed in the selection list as well but are marked with an asterisk and link to the start page of the respective language.
|
||||||
|
|
||||||
|
{{< /columns >}}
|
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 321 KiB After Width: | Height: | Size: 321 KiB |
@ -6,17 +6,17 @@ The Columns shortcode can be used to organize content side-by-side (horizontally
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
{{</* columns */>}} <!-- begin columns block -->
|
{{</* columns */>}} <!-- begin columns block -->
|
||||||
# Left Content
|
## Left Content
|
||||||
Dolor sit, sumo unique argument um no ...
|
Dolor sit, sumo unique argument um no ...
|
||||||
|
|
||||||
<---> <!-- magic separator, between columns -->
|
<---> <!-- magic separator, between columns -->
|
||||||
|
|
||||||
# Mid Content
|
## Mid Content
|
||||||
Dolor sit, sumo unique argument um no ...
|
Dolor sit, sumo unique argument um no ...
|
||||||
|
|
||||||
<---> <!-- magic separator, between columns -->
|
<---> <!-- magic separator, between columns -->
|
||||||
|
|
||||||
# Right Content
|
## Right Content
|
||||||
Dolor sit, sumo unique argument um no ...
|
Dolor sit, sumo unique argument um no ...
|
||||||
{{</* /columns */>}}
|
{{</* /columns */>}}
|
||||||
```
|
```
|
Before Width: | Height: | Size: 715 KiB After Width: | Height: | Size: 715 KiB |
Before Width: | Height: | Size: 463 KiB After Width: | Height: | Size: 463 KiB |
Before Width: | Height: | Size: 484 KiB After Width: | Height: | Size: 484 KiB |
Before Width: | Height: | Size: 472 KiB After Width: | Height: | Size: 472 KiB |
Before Width: | Height: | Size: 406 KiB After Width: | Height: | Size: 406 KiB |
Before Width: | Height: | Size: 415 KiB After Width: | Height: | Size: 415 KiB |
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
@ -49,14 +49,14 @@ This method can be used to include source code files and keep them automatically
|
|||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```tpl
|
```tpl
|
||||||
{{</* include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}}
|
{{</* include file="config/_default/config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Result:
|
Result:
|
||||||
|
|
||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
<!-- spellchecker-disable -->
|
<!-- spellchecker-disable -->
|
||||||
{{< include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" >}}
|
{{< include file="config/_default/config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" >}}
|
||||||
<!-- spellchecker-enable -->
|
<!-- spellchecker-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
@ -61,11 +61,11 @@ enableRobotsTXT = true
|
|||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocBreadcrumb = false
|
geekdocBreadcrumb = false
|
||||||
|
|
||||||
# (Optional, default none) Set source repository location. Used for 'Edit this page' links.
|
# (Optional, default none) Set source repository location. Used for 'Edit page' links.
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocRepo = "https://github.com/thegeeklab/hugo"
|
geekdocRepo = "https://github.com/thegeeklab/hugo"
|
||||||
|
|
||||||
# (Optional, default none) Enable 'Edit this page' links. Requires 'GeekdocRepo' param
|
# (Optional, default none) Enable 'Edit page' links. Requires 'GeekdocRepo' param
|
||||||
# and path must point to 'content' directory of repo.
|
# and path must point to 'content' directory of repo.
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocEditPath = "edit/main/exampleSite/content"
|
geekdocEditPath = "edit/main/exampleSite/content"
|
||||||
@ -174,11 +174,11 @@ params:
|
|||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocBreadcrumb: false
|
geekdocBreadcrumb: false
|
||||||
|
|
||||||
# (Optional, default none) Set source repository location. Used for 'Edit this page' links.
|
# (Optional, default none) Set source repository location. Used for 'Edit page' links.
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
|
|
||||||
# (Optional, default none) Enable "Edit this page" links. Requires 'GeekdocRepo' param
|
# (Optional, default none) Enable "Edit page" links. Requires 'GeekdocRepo' param
|
||||||
# and path must point to 'content' directory of repo.
|
# and path must point to 'content' directory of repo.
|
||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocEditPath: edit/main/exampleSite/content
|
geekdocEditPath: edit/main/exampleSite/content
|
||||||
@ -262,11 +262,11 @@ geekdocBreadcrumb = false
|
|||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
geekdocRepo = "https://github.com/thegeeklab/hugo-geekdoc"
|
geekdocRepo = "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
|
|
||||||
# Enable "Edit this page" links. Requires 'GeekdocRepo' param and path must point
|
# Enable "Edit page" links. Requires 'GeekdocRepo' param and path must point
|
||||||
# to 'content' directory of repo.
|
# to 'content' directory of repo.
|
||||||
geekdocEditPath = "edit/main/exampleSite/content"
|
geekdocEditPath = "edit/main/exampleSite/content"
|
||||||
|
|
||||||
# Used for 'Edit this page' link, set to '.File.Path' by default.
|
# Used for 'Edit page' link, set to '.File.Path' by default.
|
||||||
# Can be overwritten by a path relative to 'geekdocEditPath'
|
# Can be overwritten by a path relative to 'geekdocEditPath'
|
||||||
geekdocFilePath =
|
geekdocFilePath =
|
||||||
|
|
||||||
@ -322,11 +322,11 @@ geekdocBreadcrumb: false
|
|||||||
# Set source repository location.
|
# Set source repository location.
|
||||||
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
|
|
||||||
# Enable "Edit this page" links. Requires 'GeekdocRepo' param and path must point
|
# Enable "Edit page" links. Requires 'GeekdocRepo' param and path must point
|
||||||
# to 'content' directory of repo.
|
# to 'content' directory of repo.
|
||||||
geekdocEditPath: "edit/main/exampleSite/content"
|
geekdocEditPath: "edit/main/exampleSite/content"
|
||||||
|
|
||||||
# Used for 'Edit this page' link, set to '.File.Path' by default.
|
# Used for 'Edit page' link, set to '.File.Path' by default.
|
||||||
# Can be overwritten by a path relative to 'geekdocEditPath'
|
# Can be overwritten by a path relative to 'geekdocEditPath'
|
||||||
geekdocFilePath:
|
geekdocFilePath:
|
||||||
|
|
@ -33,7 +33,7 @@ content/
|
|||||||
|
|
||||||
## Bundle menu
|
## Bundle menu
|
||||||
|
|
||||||
This type of navigation needs to be enabled first by setting `geekdocMenuBundle` to `true` in your [site configuration](/usage/configuration/#site-configuration). After you have activated the bundle menu, you start with an empty navigation. This is intentional because bundle menus have to be defined manually in a data file. While this increases the effort it also offers maximum flexibility in the design. The data file needs to be written in YAML and placed at `data/menu/main.yml`.
|
This type of navigation needs to be enabled first by setting `geekdocMenuBundle` to `true` in your [site configuration](/usage/configuration/#site-configuration). After you have activated the bundle menu, you start with an empty navigation. This is intentional because bundle menus have to be defined manually in a data file. While this increases the effort it also offers maximum flexibility in the design. The data file needs to be written in YAML and placed at `data/menu/main.yaml`.
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ As an advantage you can add [icons](/features/icon-sets/) to your menu entries e
|
|||||||
The more menu is special type of the bundle menu and can be combined with the default file-tree menu.
|
The more menu is special type of the bundle menu and can be combined with the default file-tree menu.
|
||||||
{{< /hint >}}
|
{{< /hint >}}
|
||||||
|
|
||||||
As this is a special type of the bundle menu it is basically working in the same way. To enable it just add a data file to `data/menu/more.yml`. The more menu will also work with the file-tree menu and therefor **don't need to be enabled** by the `geekdocMenuBundle` parameter.
|
As this is a special type of the bundle menu it is basically working in the same way. To enable it just add a data file to `data/menu/more.yaml`. The more menu will also work with the file-tree menu and therefor **don't need to be enabled** by the `geekdocMenuBundle` parameter.
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ more:
|
|||||||
|
|
||||||
## Extra Header Menu
|
## Extra Header Menu
|
||||||
|
|
||||||
If you want to customize the header menu, this can be achieved by using a data file written in YAML and placed at `data/menu/extra.yml`.
|
If you want to customize the header menu, this can be achieved by using a data file written in YAML and placed at `data/menu/extra.yaml`.
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
@ -7,7 +7,7 @@ more:
|
|||||||
ref: "https://github.com/thegeeklab/hugo-geekdoc/releases"
|
ref: "https://github.com/thegeeklab/hugo-geekdoc/releases"
|
||||||
external: true
|
external: true
|
||||||
icon: "gdoc_download"
|
icon: "gdoc_download"
|
||||||
- name: "View Source"
|
- name: View Source
|
||||||
ref: "https://github.com/thegeeklab/hugo-geekdoc"
|
ref: "https://github.com/thegeeklab/hugo-geekdoc"
|
||||||
external: true
|
external: true
|
||||||
icon: "gdoc_github"
|
icon: "gdoc_github"
|
||||||
|
39
i18n/de.yaml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
edit_page: Seite bearbeiten
|
||||||
|
|
||||||
|
nav_navigation: Navigation
|
||||||
|
nav_tags: Tags
|
||||||
|
nav_more: Weitere
|
||||||
|
nav_top: Nach oben
|
||||||
|
|
||||||
|
form_placeholder_search: Suchen
|
||||||
|
|
||||||
|
error_page_title: Verlaufen? Keine Sorge
|
||||||
|
error_message_title: Verlaufen?
|
||||||
|
error_message_code: Fehler 404
|
||||||
|
error_message_text: >
|
||||||
|
Wir können die Seite nach der Du gesucht hast leider nicht finden. Keine Sorge,
|
||||||
|
wir bringen Dich zurück zur <a class="gdoc-error__link" href="{{ . }}">Startseite</a>.
|
||||||
|
|
||||||
|
button_toggle_dark: Wechsel zwischen Dunkel/Hell/Auto Modus
|
||||||
|
button_nav_open: Navigation öffnen
|
||||||
|
button_nav_close: Navigation schließen
|
||||||
|
button_menu_open: Menüband öffnen
|
||||||
|
button_menu_close: Menüband schließen
|
||||||
|
button_homepage: Zurück zur Startseite
|
||||||
|
|
||||||
|
title_anchor_prefix: "Link zu:"
|
||||||
|
|
||||||
|
posts_read_more: Ganzen Artikel lesen
|
||||||
|
posts_read_time:
|
||||||
|
one: "Eine Minute Lesedauer"
|
||||||
|
other: "{{ . }} Minuten Lesedauer"
|
||||||
|
posts_update_prefix: Aktualisiert am
|
||||||
|
|
||||||
|
footer_build_with: >
|
||||||
|
Entwickelt mit <a href="https://gohugo.io/" class="gdoc-footer__link">Hugo</a> und
|
||||||
|
<svg class="icon gdoc_heart"><use xlink:href="#gdoc_heart"></use></svg>
|
||||||
|
footer_legal_notice: Impressum
|
||||||
|
footer_privacy_policy: Datenschutzerklärung
|
||||||
|
|
||||||
|
language_switch_no_tranlation_prefix: "Seite nicht übersetzt:"
|
39
i18n/en.yaml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
edit_page: Edit page
|
||||||
|
|
||||||
|
nav_navigation: Navigation
|
||||||
|
nav_tags: Tags
|
||||||
|
nav_more: More
|
||||||
|
nav_top: Back to top
|
||||||
|
|
||||||
|
form_placeholder_search: Search
|
||||||
|
|
||||||
|
error_page_title: Lost? Don't worry
|
||||||
|
error_message_title: Lost?
|
||||||
|
error_message_code: Error 404
|
||||||
|
error_message_text: >
|
||||||
|
Seems like what you are looking for can't be found. Don't worry, we can
|
||||||
|
bring you back to the <a class="gdoc-error__link" href="{{ . }}">homepage</a>.
|
||||||
|
|
||||||
|
button_toggle_dark: Toggle Dark/Light/Auto mode
|
||||||
|
button_nav_open: Open Navigation
|
||||||
|
button_nav_close: Close Navigation
|
||||||
|
button_menu_open: Open Menu Bar
|
||||||
|
button_menu_close: Close Menu Bar
|
||||||
|
button_homepage: Back to homepage
|
||||||
|
|
||||||
|
title_anchor_prefix: "Anchor to:"
|
||||||
|
|
||||||
|
posts_read_more: Read full post
|
||||||
|
posts_read_time:
|
||||||
|
one: "One minute to read"
|
||||||
|
other: "{{ . }} minutes to read"
|
||||||
|
posts_update_prefix: Updated on
|
||||||
|
|
||||||
|
footer_build_with: >
|
||||||
|
Built with <a href="https://gohugo.io/" class="gdoc-footer__link">Hugo</a> and
|
||||||
|
<svg class="icon gdoc_heart"><use xlink:href="#gdoc_heart"></use></svg>
|
||||||
|
footer_legal_notice: Legal Notice
|
||||||
|
footer_privacy_policy: Privacy Policy
|
||||||
|
|
||||||
|
language_switch_no_tranlation_prefix: "Page not translated:"
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="{{ .Site.Language.Lang }}">
|
<html lang="{{ .Site.Language.Lang }}">
|
||||||
<head>
|
<head>
|
||||||
{{ partial "head/meta" . }}
|
{{ partial "head/meta" . }}
|
||||||
<title>Lost? Don't worry</title>
|
<title>{{ i18n "error_page_title" }}</title>
|
||||||
|
|
||||||
{{ partial "head/favicons" . }}
|
{{ partial "head/favicons" . }}
|
||||||
{{ partial "head/others" . }}
|
{{ partial "head/others" . }}
|
||||||
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<input type="checkbox" class="hidden" id="menu-header-control" />
|
<input type="checkbox" class="hidden" id="menu-header-control" />
|
||||||
|
|
||||||
{{ partial "site-header" (dict "Root" . "MenuEnabled" false) }}
|
{{ partial "site-header" (dict "Root" . "MenuEnabled" false) }}
|
||||||
|
|
||||||
|
|
||||||
@ -23,11 +24,10 @@
|
|||||||
<svg class="icon gdoc_cloud_off"><use xlink:href="#gdoc_cloud_off"></use></svg>
|
<svg class="icon gdoc_cloud_off"><use xlink:href="#gdoc_cloud_off"></use></svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="gdoc-error__message">
|
<div class="gdoc-error__message">
|
||||||
<div class="gdoc-error__line gdoc-error__title">Lost?</div>
|
<div class="gdoc-error__line gdoc-error__title">{{ i18n "error_message_title" }}</div>
|
||||||
<div class="gdoc-error__line gdoc-error__code">Error 404</div>
|
<div class="gdoc-error__line gdoc-error__code">{{ i18n "error_message_code" }}</div>
|
||||||
<div class="gdoc-error__line gdoc-error__help">
|
<div class="gdoc-error__line gdoc-error__help">
|
||||||
Seems like what you are looking for can't be found. Don't worry we can bring you back
|
{{ i18n "error_message_text" .Site.BaseURL | safeHTML }}
|
||||||
to the <a class="gdoc-error__link" href="{{ .Site.BaseURL }}">homepage</a>.
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="gdoc-page__anchorwrap">
|
<div class="gdoc-page__anchorwrap">
|
||||||
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
|
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text | safeHTML }}
|
||||||
<a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gdoc-page__anchor gdoc-page__anchor--right clip" aria-label="Anchor {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}">
|
<a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gdoc-page__anchor gdoc-page__anchor--right clip" title="{{ i18n "title_anchor_prefix" }} {{ .Text | safeHTML }}" aria-label="{{ i18n "title_anchor_prefix" }} {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}">
|
||||||
<svg class="icon gdoc_link"><use xlink:href="#gdoc_link"></use></svg>
|
<svg class="icon gdoc_link"><use xlink:href="#gdoc_link"></use></svg>
|
||||||
</a>
|
</a>
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
||||||
|
@ -39,7 +39,11 @@
|
|||||||
|
|
||||||
<div class="gdoc-page">
|
<div class="gdoc-page">
|
||||||
{{ template "main" . }}
|
{{ template "main" . }}
|
||||||
{{ partial "page-footer" . }}
|
|
||||||
|
|
||||||
|
<div class="gdoc-page__footer flex flex-wrap justify-between">
|
||||||
|
{{ partial "menu-nextprev" . }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{{ if default true .Site.Params.GeekdocSearch }}
|
{{ if default true .Site.Params.GeekdocSearch }}
|
||||||
<script defer src="{{ index (index .Site.Data.assets "search.js") "src" | relURL }}"></script>
|
<script defer src="{{ index (index .Site.Data.assets "search.js") "src" | relURL }}"></script>
|
||||||
{{- $searchConfig := resources.Get "search/config.json" | resources.ExecuteAsTemplate "search/config.json" . | resources.Minify -}}
|
{{- $searchConfigFile := printf "search/%s.config.json" .Language.Lang -}}
|
||||||
|
{{- $searchConfig := resources.Get "search/config.json" | resources.ExecuteAsTemplate $searchConfigFile . | resources.Minify -}}
|
||||||
{{- $searchConfig.Publish -}}
|
{{- $searchConfig.Publish -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
51
layouts/partials/language.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{{ if .Site.IsMultiLingual }}
|
||||||
|
<span class="gdoc-language">
|
||||||
|
<ul class="gdoc-language__selector" role="button" aria-pressed="false" tabindex="0">
|
||||||
|
<li>
|
||||||
|
{{ range .Site.Languages }}
|
||||||
|
{{ if eq . $.Site.Language }}
|
||||||
|
<span class="flex align-center">
|
||||||
|
<svg class="icon gdoc_language"><use xlink:href="#gdoc_language"></use></svg>
|
||||||
|
<span>{{ .Lang | upper }}</span>
|
||||||
|
</span>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="gdoc-language__list">
|
||||||
|
{{ if $.Translations }}
|
||||||
|
{{ range $.Translations }}
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
class="flex gdoc-language__entry"
|
||||||
|
title="{{ .Language.LanguageName }}"
|
||||||
|
href="{{ .RelPermalink }}"
|
||||||
|
hreflang="{{ .Lang }}"
|
||||||
|
lang="{{ .Lang }}"
|
||||||
|
>
|
||||||
|
{{ .Language.LanguageName }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ range .Site.Languages -}}
|
||||||
|
{{ if ne $.Site.Language.Lang .Lang }}
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
class="flex gdoc-language__entry"
|
||||||
|
title="{{ i18n "language_switch_no_tranlation_prefix" }} {{ .LanguageName }}"
|
||||||
|
href="{{ .Lang | relLangURL }}"
|
||||||
|
hreflang="{{ .Lang }}"
|
||||||
|
lang="{{ .Lang }}"
|
||||||
|
>
|
||||||
|
{{ .LanguageName }}*
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ end -}}
|
||||||
|
{{ end -}}
|
||||||
|
{{ end }}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</span>
|
||||||
|
{{ end }}
|
@ -27,6 +27,13 @@
|
|||||||
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
||||||
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
||||||
|
|
||||||
|
{{ if reflect.IsMap .name }}
|
||||||
|
{{ $current.Scratch.Set "refName" (index .name $site.Language.Lang) }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $current.Scratch.Set "refName" .name }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $name := $current.Scratch.Get "refName" }}
|
||||||
|
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@ -56,20 +63,20 @@
|
|||||||
{{ if $isCurrent }}is-active{{ end }}
|
{{ if $isCurrent }}is-active{{ end }}
|
||||||
{{ end }}"
|
{{ end }}"
|
||||||
>
|
>
|
||||||
{{ .name }}
|
{{ $name }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{{ if $doCollapse }}
|
{{ if $doCollapse }}
|
||||||
<svg class="icon gdoc_keyborad_arrow_left">
|
<svg class="icon toggle gdoc_keyborad_arrow_left">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<svg class="icon gdoc_keyborad_arrow_down hidden">
|
<svg class="icon toggle gdoc_keyborad_arrow_down hidden">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_down"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_down"></use>
|
||||||
</svg>
|
</svg>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</label>
|
</label>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<span class="flex">{{ .name }}</span>
|
<span class="flex">{{ $name }}</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .sub }}
|
{{ with .sub }}
|
||||||
|
@ -15,8 +15,15 @@
|
|||||||
{{ $isCurrent := eq $current $this }}
|
{{ $isCurrent := eq $current $this }}
|
||||||
{{ $icon := default false .icon }}
|
{{ $icon := default false .icon }}
|
||||||
|
|
||||||
|
{{ if reflect.IsMap .name }}
|
||||||
|
{{ $current.Scratch.Set "refName" (index .name $site.Language.Lang) }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $current.Scratch.Set "refName" .name }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $name := $current.Scratch.Get "refName" }}
|
||||||
|
|
||||||
{{ if not .icon }}
|
{{ if not .icon }}
|
||||||
{{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target .name }}
|
{{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target $name }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if eq $target "header" }}
|
{{ if eq $target "header" }}
|
||||||
@ -30,7 +37,7 @@
|
|||||||
class="gdoc-header__link"
|
class="gdoc-header__link"
|
||||||
>
|
>
|
||||||
<svg class="icon {{ .icon }}">
|
<svg class="icon {{ .icon }}">
|
||||||
<title>{{ .name }}</title>
|
<title>{{ $name }}</title>
|
||||||
<use xlink:href="#{{ .icon }}"></use>
|
<use xlink:href="#{{ .icon }}"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
|
@ -77,10 +77,10 @@
|
|||||||
<span class="flex">{{ partial "title" . }}</span>
|
<span class="flex">{{ partial "title" . }}</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if $doCollapse }}
|
{{ if $doCollapse }}
|
||||||
<svg class="icon gdoc_keyborad_arrow_left">
|
<svg class="icon toggle gdoc_keyborad_arrow_left">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<svg class="icon gdoc_keyborad_arrow_down">
|
<svg class="icon toggle gdoc_keyborad_arrow_down">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_down"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_down"></use>
|
||||||
</svg>
|
</svg>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -22,8 +22,15 @@
|
|||||||
{{ $this := $site.GetPage .ref }}
|
{{ $this := $site.GetPage .ref }}
|
||||||
{{ $current := $current.Scratch.Get "current" }}
|
{{ $current := $current.Scratch.Get "current" }}
|
||||||
|
|
||||||
|
{{ if reflect.IsMap .name }}
|
||||||
|
{{ $current.Scratch.Set "refName" (index .name $site.Language.Lang) }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $current.Scratch.Set "refName" .name }}
|
||||||
|
{{ end }}
|
||||||
|
{{ $name := $current.Scratch.Get "refName" }}
|
||||||
|
|
||||||
{{ if $current.Scratch.Get "getNext" }}
|
{{ if $current.Scratch.Get "getNext" }}
|
||||||
{{ $current.Scratch.Set "nextPage" (dict "name" .name "this" $this) }}
|
{{ $current.Scratch.Set "nextPage" (dict "name" $name "this" $this) }}
|
||||||
{{ $current.Scratch.Set "getNext" false }}
|
{{ $current.Scratch.Set "getNext" false }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@ -32,7 +39,7 @@
|
|||||||
{{ $current.Scratch.Set "getNext" true }}
|
{{ $current.Scratch.Set "getNext" true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ $current.Scratch.Set "prev" (dict "name" .name "this" $this) }}
|
{{ $current.Scratch.Set "prev" (dict "name" $name "this" $this) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ $sub := default false .sub }}
|
{{ $sub := default false .sub }}
|
||||||
@ -42,8 +49,6 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
<div class="gdoc-page__footer flex flex-wrap justify-between">
|
|
||||||
{{ $showPrevNext := (and (default true .Site.Params.GeekdocNextPrev) .Site.Params.GeekdocMenuBundle) }}
|
{{ $showPrevNext := (and (default true .Site.Params.GeekdocNextPrev) .Site.Params.GeekdocMenuBundle) }}
|
||||||
{{ if $showPrevNext }}
|
{{ if $showPrevNext }}
|
||||||
<span class="gdoc-page__nav">
|
<span class="gdoc-page__nav">
|
||||||
@ -71,4 +76,3 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<section class="gdoc-nav--main">
|
<section class="gdoc-nav--main">
|
||||||
<h2>Navigation</h2>
|
<h2>{{ i18n "nav_navigation" }}</h2>
|
||||||
{{ if .Site.Params.GeekdocMenuBundle }}
|
{{ if .Site.Params.GeekdocMenuBundle }}
|
||||||
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.main.main) }}
|
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.main.main) }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
{{ if and (in (slice "posts" "tags") .Section) (default false .Site.Params.GeekdocTagsToMenu) }}
|
{{ if and (in (slice "posts" "tags") .Section) (default false .Site.Params.GeekdocTagsToMenu) }}
|
||||||
<section class="gdoc-nav--tags">
|
<section class="gdoc-nav--tags">
|
||||||
<h2>Tags</h2>
|
<h2>{{ i18n "nav_tags" }}</h2>
|
||||||
<ul class="gdoc-nav__list">
|
<ul class="gdoc-nav__list">
|
||||||
{{ $currentPage := .RelPermalink }}
|
{{ $currentPage := .RelPermalink }}
|
||||||
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
|
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
|
||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<section class="gdoc-nav--more">
|
<section class="gdoc-nav--more">
|
||||||
{{ if .Site.Data.menu.more.more }}
|
{{ if .Site.Data.menu.more.more }}
|
||||||
<h2>More</h2>
|
<h2>{{ i18n "nav_more" }}</h2>
|
||||||
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.more.more) }}
|
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.more.more) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<a
|
<a
|
||||||
href="{{ $geekdocRepo }}/{{ path.Join $geekdocEditPath ($.Scratch.Get "geekdocFilePath") }}"
|
href="{{ $geekdocRepo }}/{{ path.Join $geekdocEditPath ($.Scratch.Get "geekdocFilePath") }}"
|
||||||
>
|
>
|
||||||
Edit this page
|
{{ i18n "edit_page" }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<span class="gdoc-post__tag">
|
<span class="gdoc-post__tag">
|
||||||
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
|
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
|
||||||
{{ if .Lastmod.After (.Date.AddDate 0 0 1) }}
|
{{ if .Lastmod.After (.Date.AddDate 0 0 1) }}
|
||||||
Updated on
|
{{ i18n "posts_update_prefix" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ .Lastmod.Format "Jan 2, 2006" }}
|
{{ .Lastmod.Format "Jan 2, 2006" }}
|
||||||
</time>
|
</time>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<span class="no-wrap">
|
<span class="no-wrap">
|
||||||
<svg class="icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
<svg class="icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
<span class="gdoc-post__tag">{{ i18n "posts_read_time" .ReadingTime }}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{{ $tc := 0 }}
|
{{ $tc := 0 }}
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
type="text"
|
type="text"
|
||||||
id="gdoc-search-input"
|
id="gdoc-search-input"
|
||||||
class="gdoc-search__input"
|
class="gdoc-search__input"
|
||||||
placeholder="Search..."
|
placeholder="{{ i18n "form_placeholder_search" }}"
|
||||||
aria-label="Search"
|
aria-label="{{ i18n "form_placeholder_search" }}"
|
||||||
maxlength="64"
|
maxlength="64"
|
||||||
data-site-base-url="{{ .Site.BaseURL }}"
|
data-site-base-url="{{ .Site.BaseURL }}"
|
||||||
|
data-site-lang="{{ .Site.Language.Lang }}"
|
||||||
/>
|
/>
|
||||||
<div class="gdoc-search__spinner spinner hidden"></div>
|
<div class="gdoc-search__spinner spinner hidden"></div>
|
||||||
<ul id="gdoc-search-results" class="gdoc-search__list"></ul>
|
<ul id="gdoc-search-results" class="gdoc-search__list"></ul>
|
||||||
|
@ -2,28 +2,31 @@
|
|||||||
<div class="container flex">
|
<div class="container flex">
|
||||||
<div class="flex flex-wrap">
|
<div class="flex flex-wrap">
|
||||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||||
Built with <a href="https://gohugo.io/" class="gdoc-footer__link">Hugo</a> and
|
{{ i18n "footer_build_with" | safeHTML }}
|
||||||
<svg class="icon gdoc_heart"><use xlink:href="#gdoc_heart"></use></svg>
|
|
||||||
</span>
|
</span>
|
||||||
{{ with .Site.Params.GeekdocLegalNotice }}
|
{{ with .Site.Params.GeekdocLegalNotice }}
|
||||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||||
<a href="{{ . | relURL }}" class="gdoc-footer__link">Legal Notice</a>
|
<a href="{{ . | relURL }}" class="gdoc-footer__link">
|
||||||
|
{{ i18n "footer_legal_notice" }}
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with .Site.Params.GeekdocPrivacyPolicy }}
|
{{ with .Site.Params.GeekdocPrivacyPolicy }}
|
||||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||||
<a href="{{ . | relURL }}" class="gdoc-footer__link">Privacy Policy</a>
|
<a href="{{ . | relURL }}" class="gdoc-footer__link">
|
||||||
|
{{ i18n "footer_privacy_policy" }}
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ if (default true .Site.Params.GeekdocBackToTop) }}
|
{{ if (default true .Site.Params.GeekdocBackToTop) }}
|
||||||
<div class="flex flex-25 justify-end">
|
<div class="flex flex-25 justify-end">
|
||||||
<span class="gdoc-footer__item text-right">
|
<span class="gdoc-footer__item text-right">
|
||||||
<a class="gdoc-footer__link fake-link" href="#" aria-label="Back to top">
|
<a class="gdoc-footer__link fake-link" href="#" aria-label="{{ i18n "nav_top" }}">
|
||||||
<svg class="icon gdoc_keyborad_arrow_up">
|
<svg class="icon gdoc_keyborad_arrow_up">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_up"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_up"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<span class="hidden-mobile">Back to top</span>
|
<span class="hidden-mobile">{{ i18n "nav_top" }}</span>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
<header class="gdoc-header">
|
<header class="gdoc-header">
|
||||||
<div class="container flex align-center justify-between">
|
<div class="container flex align-center justify-between">
|
||||||
{{ if .MenuEnabled }}
|
{{ if .MenuEnabled }}
|
||||||
<label for="menu-control" class="gdoc-nav__control">
|
<label for="menu-control" class="gdoc-nav__control" tabindex="0">
|
||||||
<svg class="icon gdoc_menu">
|
<svg class="icon gdoc_menu">
|
||||||
<title>Open Nav Menu</title>
|
<title>{{ i18n "button_nav_open" }}</title>
|
||||||
<use xlink:href="#gdoc_menu"></use>
|
<use xlink:href="#gdoc_menu"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<svg class="icon gdoc_arrow_back">
|
<svg class="icon gdoc_arrow_back">
|
||||||
<title>Close Nav Menu</title>
|
<title>{{ i18n "button_nav_close" }}</title>
|
||||||
<use xlink:href="#gdoc_arrow_back"></use>
|
<use xlink:href="#gdoc_arrow_back"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</label>
|
</label>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<a class="gdoc-header__link" href="{{ .Root.Site.BaseURL }}">
|
<div>
|
||||||
<span class="gdoc-brand flex align-center">
|
<a class="gdoc-brand gdoc-header__link" href="{{ .Root.Site.BaseURL }}">
|
||||||
|
<span class="flex align-center">
|
||||||
<img
|
<img
|
||||||
class="gdoc-brand__img"
|
class="gdoc-brand__img"
|
||||||
src="{{ (default "brand.svg" .Root.Site.Params.GeekdocLogo) | relURL }}"
|
src="{{ (default "brand.svg" .Root.Site.Params.GeekdocLogo) | relURL }}"
|
||||||
@ -22,39 +23,50 @@
|
|||||||
<span class="gdoc-brand__title">{{ .Root.Site.Title }}</span>
|
<span class="gdoc-brand__title">{{ .Root.Site.Title }}</span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
</div>
|
||||||
<div class="gdoc-menu-header">
|
<div class="gdoc-menu-header">
|
||||||
<span {{ if .Root.Site.Data.menu.extra.header }}class="gdoc-menu-header__items"{{ end }}>
|
<span
|
||||||
|
{{ if .Root.Site.Data.menu.extra.header }}class="gdoc-menu-header__items"{{ end }}
|
||||||
|
>
|
||||||
{{ if .Root.Site.Data.menu.extra.header }}
|
{{ if .Root.Site.Data.menu.extra.header }}
|
||||||
{{ partial "menu-extra" (dict "current" .Root "source" .Root.Site.Data.menu.extra.header "target" "header") }}
|
{{ partial "menu-extra" (dict "current" .Root "source" .Root.Site.Data.menu.extra.header "target" "header") }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
<span id="gdoc-dark-mode">
|
<span id="gdoc-dark-mode">
|
||||||
<svg class="icon gdoc_brightness_dark">
|
<svg class="icon gdoc_brightness_dark">
|
||||||
<title>Toggle Dark/Light/Auto mode</title>
|
<title>{{ i18n "button_toggle_dark" }}</title>
|
||||||
<use xlink:href="#gdoc_brightness_dark"></use>
|
<use xlink:href="#gdoc_brightness_dark"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<svg class="icon gdoc_brightness_light">
|
<svg class="icon gdoc_brightness_light">
|
||||||
<title>Toggle Dark/Light/Auto mode</title>
|
<title>{{ i18n "button_toggle_dark" }}</title>
|
||||||
<use xlink:href="#gdoc_brightness_light"></use>
|
<use xlink:href="#gdoc_brightness_light"></use>
|
||||||
</svg>
|
</svg>
|
||||||
<svg class="icon gdoc_brightness_auto">
|
<svg class="icon gdoc_brightness_auto">
|
||||||
<title>Toggle Dark/Light/Auto mode</title>
|
<title>{{ i18n "button_toggle_dark" }}</title>
|
||||||
<use xlink:href="#gdoc_brightness_auto"></use>
|
<use xlink:href="#gdoc_brightness_auto"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{{ if .Root.Site.Data.menu.extra.header }}
|
{{ if .Root.Site.Data.menu.extra.header }}
|
||||||
<span class="gdoc-menu-header__home">
|
<span class="gdoc-menu-header__home">
|
||||||
<a href="{{ .Root.Site.BaseURL }}" class="gdoc-header__link">
|
<a href="{{ .Root.Site.BaseURL }}" class="gdoc-header__link">
|
||||||
<svg class="icon gdoc_home">
|
<svg class="icon gdoc_home">
|
||||||
<title>Back to homepage</title>
|
<title>{{ i18n "button_homepage" }}</title>
|
||||||
<use xlink:href="#gdoc_home"></use>
|
<use xlink:href="#gdoc_home"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ partial "language" .Root }}
|
||||||
|
|
||||||
|
{{ if .Root.Site.Data.menu.extra.header }}
|
||||||
<span class="gdoc-menu-header__control">
|
<span class="gdoc-menu-header__control">
|
||||||
<label for="menu-header-control">
|
<label for="menu-header-control">
|
||||||
<svg class="icon gdoc_keyborad_arrow_right">
|
<svg class="icon gdoc_keyborad_arrow_right">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_right"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_right"></use>
|
||||||
<title>Close Menu Bar</title>
|
<title>{{ i18n "button_menu_close" }}</title>
|
||||||
</svg>
|
</svg>
|
||||||
</label>
|
</label>
|
||||||
</span>
|
</span>
|
||||||
@ -64,7 +76,7 @@
|
|||||||
<label for="menu-header-control" class="gdoc-menu-header__control">
|
<label for="menu-header-control" class="gdoc-menu-header__control">
|
||||||
<svg class="icon gdoc_keyborad_arrow_left">
|
<svg class="icon gdoc_keyborad_arrow_left">
|
||||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||||
<title>Open Menu Bar</title>
|
<title>{{ i18n "button_menu_open" }}</title>
|
||||||
</svg>
|
</svg>
|
||||||
</label>
|
</label>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
{{ if .Truncated }}
|
{{ if .Truncated }}
|
||||||
<a
|
<a
|
||||||
class="flex-inline align-center fake-link"
|
class="flex-inline align-center fake-link"
|
||||||
title="Read full post"
|
title="{{ i18n "posts_read_more" }}"
|
||||||
href="{{ .RelPermalink }}"
|
href="{{ .RelPermalink }}"
|
||||||
>
|
>
|
||||||
Read full post
|
{{ i18n "posts_read_more" }}
|
||||||
<i class="gdoc-icon">gdoc_arrow_right_alt</i>
|
<i class="gdoc-icon">gdoc_arrow_right_alt</i>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
{{ if .Truncated }}
|
{{ if .Truncated }}
|
||||||
<a
|
<a
|
||||||
class="flex-inline align-center fake-link"
|
class="flex-inline align-center fake-link"
|
||||||
title="Read full post"
|
title="{{ i18n "posts_read_more" }}"
|
||||||
href="{{ .RelPermalink }}"
|
href="{{ .RelPermalink }}"
|
||||||
>
|
>
|
||||||
Read full post
|
{{ i18n "posts_read_more" }}
|
||||||
<i class="gdoc-icon">gdoc_arrow_right_alt</i>
|
<i class="gdoc-icon">gdoc_arrow_right_alt</i>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"prep:clean": "shx rm -rf build/ static/",
|
"prep:clean": "shx rm -rf build/ static/",
|
||||||
"prep:clean-all": "shx rm -rf build/ dist/ static/ data/ assets/sprites/ exampleSite/data/sprites/",
|
"prep:clean-all": "shx rm -rf build/ dist/ static/ data/ assets/sprites/ exampleSite/data/sprites/",
|
||||||
"prep:make": "mkdir -p build/icons/ build/fonts/ dist/",
|
"prep:make": "mkdir -p build/icons/ build/fonts/ dist/",
|
||||||
"svg-sprite-list": "run-s prep:make svg ; mkdir -p exampleSite/data/sprites/ ; cp build/fonts/GeekdocIcons.json exampleSite/data/sprites/geekdoc.json",
|
"svg-sprite-list": "run-s prep:make svg ; mkdir -p exampleSite/data/sprites/ ; shx cp build/fonts/GeekdocIcons.json exampleSite/data/sprites/geekdoc.json",
|
||||||
"lint": "eslint src/js/ --color"
|
"lint": "eslint src/js/ --color"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
5
src/icons/language.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<!-- Generated by IcoMoon.io -->
|
||||||
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 28 28">
|
||||||
|
<title>language</title>
|
||||||
|
<path d="M20.112 16.826h4.732q0.394-1.84 0.394-2.826t-0.394-2.826h-4.732q0.197 1.38 0.197 2.826t-0.197 2.826zM17.615 24.582q1.643-0.526 3.418-2.005t2.695-2.991h-4.141q-0.657 2.629-1.972 4.995zM17.286 16.826q0.197-1.38 0.197-2.826t-0.197-2.826h-6.573q-0.197 1.38-0.197 2.826t0.197 2.826h6.573zM14 25.173q1.84-2.695 2.695-5.587h-5.39q0.854 2.892 2.695 5.587zM8.413 8.413q0.789-2.826 1.972-4.995-1.643 0.526-3.451 2.005t-2.662 2.991h4.141zM4.272 19.587q0.854 1.512 2.662 2.991t3.451 2.005q-1.315-2.366-1.972-4.995h-4.141zM3.155 16.826h4.732q-0.197-1.38-0.197-2.826t0.197-2.826h-4.732q-0.394 1.84-0.394 2.826t0.394 2.826zM14 2.826q-1.84 2.695-2.695 5.587h5.39q-0.854-2.892-2.695-5.587zM23.727 8.413q-0.92-1.512-2.695-2.991t-3.418-2.005q1.183 2.169 1.972 4.995h4.141zM14 0q5.784 0 9.892 4.108t4.108 9.892-4.108 9.892-9.892 4.108-9.892-4.108-4.108-9.892 4.108-9.892 9.892-4.108z"></path>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
@ -6,6 +6,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
|||||||
const input = document.querySelector("#gdoc-search-input")
|
const input = document.querySelector("#gdoc-search-input")
|
||||||
const results = document.querySelector("#gdoc-search-results")
|
const results = document.querySelector("#gdoc-search-results")
|
||||||
const basePath = urlPath(input ? input.dataset.siteBaseUrl : "")
|
const basePath = urlPath(input ? input.dataset.siteBaseUrl : "")
|
||||||
|
const lang = input ? input.dataset.siteLang : ""
|
||||||
|
|
||||||
const configSchema = {
|
const configSchema = {
|
||||||
type: "object",
|
type: "object",
|
||||||
@ -26,7 +27,7 @@ document.addEventListener("DOMContentLoaded", function (event) {
|
|||||||
|
|
||||||
if (!input) return
|
if (!input) return
|
||||||
|
|
||||||
getJson(combineURLs(basePath, "/search/config.min.json"), function (searchConfig) {
|
getJson(combineURLs(basePath, "/search/" + lang + ".config.min.json"), function (searchConfig) {
|
||||||
const validationResult = validator.validate(searchConfig)
|
const validationResult = validator.validate(searchConfig)
|
||||||
|
|
||||||
if (!validationResult.valid)
|
if (!validationResult.valid)
|
||||||
|
@ -204,7 +204,7 @@ img {
|
|||||||
|
|
||||||
.gdoc-menu-header {
|
.gdoc-menu-header {
|
||||||
&__items {
|
&__items {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
margin-left: $padding-8;
|
margin-left: $padding-8;
|
||||||
@ -287,7 +287,7 @@ img {
|
|||||||
& ~ label {
|
& ~ label {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
.icon {
|
.icon.toggle {
|
||||||
font-size: $font-size-12;
|
font-size: $font-size-12;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,7 +323,8 @@ img {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.gdoc-nav__entry,
|
.gdoc-nav__entry,
|
||||||
.gdoc-search__entry {
|
.gdoc-search__entry,
|
||||||
|
.gdoc-language__entry {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
color: var(--body-font-color);
|
color: var(--body-font-color);
|
||||||
|
|
||||||
@ -338,8 +339,21 @@ img {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gdoc-search__list,
|
||||||
|
.gdoc-language__list {
|
||||||
|
background: var(--body-background);
|
||||||
|
border-radius: $border-radius;
|
||||||
|
box-shadow: 0 1px 3px 0 var(--accent-color), 0 1px 2px 0 var(--accent-color-lite);
|
||||||
|
position: absolute;
|
||||||
|
margin: 0;
|
||||||
|
padding: $padding-8 !important;
|
||||||
|
list-style: none;
|
||||||
|
top: calc(100% + #{$padding-8});
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
.gdoc-page {
|
.gdoc-page {
|
||||||
min-width: $body-min-width;
|
min-width: calc($body-min-width - $padding-16 * 2);
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
padding: $padding-16 0;
|
padding: $padding-16 0;
|
||||||
|
|
||||||
@ -594,17 +608,8 @@ img {
|
|||||||
|
|
||||||
&__list {
|
&__list {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
background: var(--body-background);
|
|
||||||
border-radius: $border-radius;
|
|
||||||
box-shadow: 0 1px 3px 0 var(--accent-color), 0 1px 2px 0 var(--accent-color-lite);
|
|
||||||
position: absolute;
|
|
||||||
margin: 0;
|
|
||||||
padding: $padding-8;
|
|
||||||
list-style: none;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
top: calc(100% + #{$padding-8});
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 2;
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@ -635,6 +640,33 @@ img {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gdoc-language {
|
||||||
|
&__selector {
|
||||||
|
position: relative;
|
||||||
|
list-style: none;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&:focus,
|
||||||
|
&:focus-within,
|
||||||
|
&:active {
|
||||||
|
.gdoc-language__list {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__list {
|
||||||
|
display: none;
|
||||||
|
right: 0;
|
||||||
|
width: auto;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.gdoc-error {
|
.gdoc-error {
|
||||||
padding: $padding-16 * 6 $padding-16;
|
padding: $padding-16 * 6 $padding-16;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -56,10 +56,7 @@ $main-color: rgba(65, 134, 201, 1) !default;
|
|||||||
$second-color: rgba(47, 51, 62, 1) !default;
|
$second-color: rgba(47, 51, 62, 1) !default;
|
||||||
$mark-color: rgba(255, 171, 0, 1) !default;
|
$mark-color: rgba(255, 171, 0, 1) !default;
|
||||||
|
|
||||||
$body-background-dark: mix(
|
$body-background-dark: mix(invert($body-background, 75%), $second-color) !default;
|
||||||
invert($body-background, 75%),
|
|
||||||
$second-color
|
|
||||||
) !default;
|
|
||||||
$link-color-dark: rgba(110, 168, 212, 1) !default;
|
$link-color-dark: rgba(110, 168, 212, 1) !default;
|
||||||
$link-color-visited-dark: rgba(186, 142, 240) !default;
|
$link-color-visited-dark: rgba(186, 142, 240) !default;
|
||||||
|
|
||||||
@ -76,5 +73,5 @@ $hint-colors: (
|
|||||||
info: rgba(0, 145, 234, 1),
|
info: rgba(0, 145, 234, 1),
|
||||||
ok: rgba(0, 200, 83, 1),
|
ok: rgba(0, 200, 83, 1),
|
||||||
warning: rgba(255, 171, 0, 1),
|
warning: rgba(255, 171, 0, 1),
|
||||||
danger: rgba(213, 0, 0, 1),
|
danger: rgba(213, 0, 0, 1)
|
||||||
) !default;
|
) !default;
|
||||||
|
@ -45,8 +45,7 @@
|
|||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Metropolis";
|
font-family: "Metropolis";
|
||||||
src: url("fonts/Metropolis.woff2") format("woff2"),
|
src: url("fonts/Metropolis.woff2") format("woff2"), url("fonts/Metropolis.woff") format("woff");
|
||||||
url("fonts/Metropolis.woff") format("woff");
|
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
.gdoc-brand {
|
.gdoc-brand {
|
||||||
font-size: $font-size-24;
|
font-size: $font-size-24;
|
||||||
|
line-height: $font-size-24;
|
||||||
|
|
||||||
&__img {
|
&__img {
|
||||||
display: none;
|
display: none;
|
||||||
@ -30,7 +31,7 @@
|
|||||||
|
|
||||||
&__control,
|
&__control,
|
||||||
&__home {
|
&__home {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,13 +87,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#menu-header-control:checked ~ .gdoc-header {
|
#menu-header-control:checked ~ .gdoc-header {
|
||||||
.gdoc-brand__title {
|
.gdoc-brand {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gdoc-menu-header {
|
.gdoc-menu-header {
|
||||||
&__items {
|
&__items {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__control {
|
&__control {
|
||||||
|