diff --git a/.dictionary b/.dictionary index acee446..2d70b4d 100644 --- a/.dictionary +++ b/.dictionary @@ -29,3 +29,4 @@ KaTeX katex Theming Favicon[s]? +UI diff --git a/.gitignore b/.gitignore index bf24110..470fb8c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,12 @@ /lhci_reports/ /exampleSite/themes/ /exampleSite/public/ +/exampleSite/config/development/ CHANGELOG.md +# translation envs +exampleSite/content/de + # auto-generated files /data/ /static/ diff --git a/exampleSite/config.yaml b/exampleSite/config/_default/config.yaml similarity index 52% rename from exampleSite/config.yaml rename to exampleSite/config/_default/config.yaml index 22d8dc7..ec6dfb4 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config/_default/config.yaml @@ -2,11 +2,14 @@ baseURL: https://geekdocs.de/ title: Geekdocs theme: hugo-geekdoc + pygmentsUseClasses: true pygmentsCodeFences: true timeout: 180000 pluralizeListTitles: false +defaultContentLanguage: en + disablePathToLower: true enableGitInfo: true @@ -34,19 +37,3 @@ outputs: - HTML term: - 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 diff --git a/exampleSite/config/_default/languages.yaml b/exampleSite/config/_default/languages.yaml new file mode 100644 index 0000000..8a7a049 --- /dev/null +++ b/exampleSite/config/_default/languages.yaml @@ -0,0 +1,5 @@ +--- +en: + languageName: "English" + contentDir: "content/en" + weight: 10 diff --git a/exampleSite/config/_default/params.yaml b/exampleSite/config/_default/params.yaml new file mode 100644 index 0000000..bd0c2e4 --- /dev/null +++ b/exampleSite/config/_default/params.yaml @@ -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 diff --git a/exampleSite/content/_includes/_index.md b/exampleSite/content/en/_includes/_index.md similarity index 100% rename from exampleSite/content/_includes/_index.md rename to exampleSite/content/en/_includes/_index.md diff --git a/exampleSite/content/_includes/include-page.md b/exampleSite/content/en/_includes/include-page.md similarity index 100% rename from exampleSite/content/_includes/include-page.md rename to exampleSite/content/en/_includes/include-page.md diff --git a/exampleSite/content/_index.md b/exampleSite/content/en/_index.md similarity index 100% rename from exampleSite/content/_index.md rename to exampleSite/content/en/_index.md diff --git a/exampleSite/content/collapse/_index.md b/exampleSite/content/en/collapse/_index.md similarity index 100% rename from exampleSite/content/collapse/_index.md rename to exampleSite/content/en/collapse/_index.md diff --git a/exampleSite/content/collapse/level-1/_index.md b/exampleSite/content/en/collapse/level-1/_index.md similarity index 100% rename from exampleSite/content/collapse/level-1/_index.md rename to exampleSite/content/en/collapse/level-1/_index.md diff --git a/exampleSite/content/collapse/level-1/level-1-1.md b/exampleSite/content/en/collapse/level-1/level-1-1.md similarity index 100% rename from exampleSite/content/collapse/level-1/level-1-1.md rename to exampleSite/content/en/collapse/level-1/level-1-1.md diff --git a/exampleSite/content/collapse/level-1/level-1-2.md b/exampleSite/content/en/collapse/level-1/level-1-2.md similarity index 100% rename from exampleSite/content/collapse/level-1/level-1-2.md rename to exampleSite/content/en/collapse/level-1/level-1-2.md diff --git a/exampleSite/content/collapse/level-2/_index.md b/exampleSite/content/en/collapse/level-2/_index.md similarity index 100% rename from exampleSite/content/collapse/level-2/_index.md rename to exampleSite/content/en/collapse/level-2/_index.md diff --git a/exampleSite/content/collapse/level-2/level-2-1.md b/exampleSite/content/en/collapse/level-2/level-2-1.md similarity index 100% rename from exampleSite/content/collapse/level-2/level-2-1.md rename to exampleSite/content/en/collapse/level-2/level-2-1.md diff --git a/exampleSite/content/collapse/level-2/level-2-2.md b/exampleSite/content/en/collapse/level-2/level-2-2.md similarity index 100% rename from exampleSite/content/collapse/level-2/level-2-2.md rename to exampleSite/content/en/collapse/level-2/level-2-2.md diff --git a/exampleSite/content/features/_index.md b/exampleSite/content/en/features/_index.md similarity index 100% rename from exampleSite/content/features/_index.md rename to exampleSite/content/en/features/_index.md diff --git a/exampleSite/content/features/code-blocks.md b/exampleSite/content/en/features/code-blocks.md similarity index 100% rename from exampleSite/content/features/code-blocks.md rename to exampleSite/content/en/features/code-blocks.md diff --git a/exampleSite/content/features/dark-mode/_index.md b/exampleSite/content/en/features/dark-mode/_index.md similarity index 100% rename from exampleSite/content/features/dark-mode/_index.md rename to exampleSite/content/en/features/dark-mode/_index.md diff --git a/exampleSite/content/features/dark-mode/images/geekdoc-dark.png b/exampleSite/content/en/features/dark-mode/images/geekdoc-dark.png similarity index 100% rename from exampleSite/content/features/dark-mode/images/geekdoc-dark.png rename to exampleSite/content/en/features/dark-mode/images/geekdoc-dark.png diff --git a/exampleSite/content/features/icon-sets.md b/exampleSite/content/en/features/icon-sets.md similarity index 100% rename from exampleSite/content/features/icon-sets.md rename to exampleSite/content/en/features/icon-sets.md diff --git a/exampleSite/content/en/features/multilingual/_index.md b/exampleSite/content/en/features/multilingual/_index.md new file mode 100644 index 0000000..9ce194a --- /dev/null +++ b/exampleSite/content/en/features/multilingual/_index.md @@ -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/.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//` 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 >}} diff --git a/exampleSite/content/en/features/multilingual/images/translation-available.png b/exampleSite/content/en/features/multilingual/images/translation-available.png new file mode 100644 index 0000000..838d06e Binary files /dev/null and b/exampleSite/content/en/features/multilingual/images/translation-available.png differ diff --git a/exampleSite/content/en/features/multilingual/images/translation-not-available.png b/exampleSite/content/en/features/multilingual/images/translation-not-available.png new file mode 100644 index 0000000..8220acf Binary files /dev/null and b/exampleSite/content/en/features/multilingual/images/translation-not-available.png differ diff --git a/exampleSite/content/features/theming/_index.md b/exampleSite/content/en/features/theming/_index.md similarity index 100% rename from exampleSite/content/features/theming/_index.md rename to exampleSite/content/en/features/theming/_index.md diff --git a/exampleSite/content/features/theming/images/theme-example.png b/exampleSite/content/en/features/theming/images/theme-example.png similarity index 100% rename from exampleSite/content/features/theming/images/theme-example.png rename to exampleSite/content/en/features/theming/images/theme-example.png diff --git a/exampleSite/content/posts/_index.md b/exampleSite/content/en/posts/_index.md similarity index 100% rename from exampleSite/content/posts/_index.md rename to exampleSite/content/en/posts/_index.md diff --git a/exampleSite/content/posts/hello_geekdoc.md b/exampleSite/content/en/posts/hello_geekdoc.md similarity index 100% rename from exampleSite/content/posts/hello_geekdoc.md rename to exampleSite/content/en/posts/hello_geekdoc.md diff --git a/exampleSite/content/posts/initial-release.md b/exampleSite/content/en/posts/initial-release.md similarity index 100% rename from exampleSite/content/posts/initial-release.md rename to exampleSite/content/en/posts/initial-release.md diff --git a/exampleSite/content/shortcodes/_index.md b/exampleSite/content/en/shortcodes/_index.md similarity index 100% rename from exampleSite/content/shortcodes/_index.md rename to exampleSite/content/en/shortcodes/_index.md diff --git a/exampleSite/content/shortcodes/buttons.md b/exampleSite/content/en/shortcodes/buttons.md similarity index 100% rename from exampleSite/content/shortcodes/buttons.md rename to exampleSite/content/en/shortcodes/buttons.md diff --git a/exampleSite/content/shortcodes/columns.md b/exampleSite/content/en/shortcodes/columns.md similarity index 96% rename from exampleSite/content/shortcodes/columns.md rename to exampleSite/content/en/shortcodes/columns.md index 5f37e00..91043cd 100644 --- a/exampleSite/content/shortcodes/columns.md +++ b/exampleSite/content/en/shortcodes/columns.md @@ -6,17 +6,17 @@ The Columns shortcode can be used to organize content side-by-side (horizontally ```html {{}} -# Left Content +## Left Content Dolor sit, sumo unique argument um no ... <---> -# Mid Content +## Mid Content Dolor sit, sumo unique argument um no ... <---> -# Right Content +## Right Content Dolor sit, sumo unique argument um no ... {{}} ``` diff --git a/exampleSite/content/shortcodes/expand.md b/exampleSite/content/en/shortcodes/expand.md similarity index 100% rename from exampleSite/content/shortcodes/expand.md rename to exampleSite/content/en/shortcodes/expand.md diff --git a/exampleSite/content/shortcodes/hints.md b/exampleSite/content/en/shortcodes/hints.md similarity index 100% rename from exampleSite/content/shortcodes/hints.md rename to exampleSite/content/en/shortcodes/hints.md diff --git a/exampleSite/content/shortcodes/icons.md b/exampleSite/content/en/shortcodes/icons.md similarity index 100% rename from exampleSite/content/shortcodes/icons.md rename to exampleSite/content/en/shortcodes/icons.md diff --git a/exampleSite/content/shortcodes/images/_index.md b/exampleSite/content/en/shortcodes/images/_index.md similarity index 100% rename from exampleSite/content/shortcodes/images/_index.md rename to exampleSite/content/en/shortcodes/images/_index.md diff --git a/exampleSite/content/shortcodes/images/forest-1.jpg b/exampleSite/content/en/shortcodes/images/forest-1.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-1.jpg rename to exampleSite/content/en/shortcodes/images/forest-1.jpg diff --git a/exampleSite/content/shortcodes/images/forest-2.jpg b/exampleSite/content/en/shortcodes/images/forest-2.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-2.jpg rename to exampleSite/content/en/shortcodes/images/forest-2.jpg diff --git a/exampleSite/content/shortcodes/images/forest-3.jpg b/exampleSite/content/en/shortcodes/images/forest-3.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-3.jpg rename to exampleSite/content/en/shortcodes/images/forest-3.jpg diff --git a/exampleSite/content/shortcodes/images/forest-4.jpg b/exampleSite/content/en/shortcodes/images/forest-4.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-4.jpg rename to exampleSite/content/en/shortcodes/images/forest-4.jpg diff --git a/exampleSite/content/shortcodes/images/forest-5.jpg b/exampleSite/content/en/shortcodes/images/forest-5.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-5.jpg rename to exampleSite/content/en/shortcodes/images/forest-5.jpg diff --git a/exampleSite/content/shortcodes/images/forest-6.jpg b/exampleSite/content/en/shortcodes/images/forest-6.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-6.jpg rename to exampleSite/content/en/shortcodes/images/forest-6.jpg diff --git a/exampleSite/content/shortcodes/images/forest-7.jpg b/exampleSite/content/en/shortcodes/images/forest-7.jpg similarity index 100% rename from exampleSite/content/shortcodes/images/forest-7.jpg rename to exampleSite/content/en/shortcodes/images/forest-7.jpg diff --git a/exampleSite/content/shortcodes/includes.md b/exampleSite/content/en/shortcodes/includes.md similarity index 93% rename from exampleSite/content/shortcodes/includes.md rename to exampleSite/content/en/shortcodes/includes.md index e7026dd..b092f53 100644 --- a/exampleSite/content/shortcodes/includes.md +++ b/exampleSite/content/en/shortcodes/includes.md @@ -49,14 +49,14 @@ This method can be used to include source code files and keep them automatically ```tpl -{{}} +{{}} ``` Result: -{{< 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" >}} diff --git a/exampleSite/content/shortcodes/katex.md b/exampleSite/content/en/shortcodes/katex.md similarity index 100% rename from exampleSite/content/shortcodes/katex.md rename to exampleSite/content/en/shortcodes/katex.md diff --git a/exampleSite/content/shortcodes/mermaid.md b/exampleSite/content/en/shortcodes/mermaid.md similarity index 100% rename from exampleSite/content/shortcodes/mermaid.md rename to exampleSite/content/en/shortcodes/mermaid.md diff --git a/exampleSite/content/shortcodes/tabs.md b/exampleSite/content/en/shortcodes/tabs.md similarity index 100% rename from exampleSite/content/shortcodes/tabs.md rename to exampleSite/content/en/shortcodes/tabs.md diff --git a/exampleSite/content/shortcodes/toc-tree.md b/exampleSite/content/en/shortcodes/toc-tree.md similarity index 100% rename from exampleSite/content/shortcodes/toc-tree.md rename to exampleSite/content/en/shortcodes/toc-tree.md diff --git a/exampleSite/content/shortcodes/toc.md b/exampleSite/content/en/shortcodes/toc.md similarity index 100% rename from exampleSite/content/shortcodes/toc.md rename to exampleSite/content/en/shortcodes/toc.md diff --git a/exampleSite/content/toc-tree/_index.md b/exampleSite/content/en/toc-tree/_index.md similarity index 100% rename from exampleSite/content/toc-tree/_index.md rename to exampleSite/content/en/toc-tree/_index.md diff --git a/exampleSite/content/toc-tree/level-1/_index.md b/exampleSite/content/en/toc-tree/level-1/_index.md similarity index 100% rename from exampleSite/content/toc-tree/level-1/_index.md rename to exampleSite/content/en/toc-tree/level-1/_index.md diff --git a/exampleSite/content/toc-tree/level-1/level-1-1.md b/exampleSite/content/en/toc-tree/level-1/level-1-1.md similarity index 100% rename from exampleSite/content/toc-tree/level-1/level-1-1.md rename to exampleSite/content/en/toc-tree/level-1/level-1-1.md diff --git a/exampleSite/content/toc-tree/level-1/level-1-2.md b/exampleSite/content/en/toc-tree/level-1/level-1-2.md similarity index 100% rename from exampleSite/content/toc-tree/level-1/level-1-2.md rename to exampleSite/content/en/toc-tree/level-1/level-1-2.md diff --git a/exampleSite/content/toc-tree/level-1/level-1-3/_index.md b/exampleSite/content/en/toc-tree/level-1/level-1-3/_index.md similarity index 100% rename from exampleSite/content/toc-tree/level-1/level-1-3/_index.md rename to exampleSite/content/en/toc-tree/level-1/level-1-3/_index.md diff --git a/exampleSite/content/toc-tree/level-1/level-1-3/level-1-3-1.md b/exampleSite/content/en/toc-tree/level-1/level-1-3/level-1-3-1.md similarity index 100% rename from exampleSite/content/toc-tree/level-1/level-1-3/level-1-3-1.md rename to exampleSite/content/en/toc-tree/level-1/level-1-3/level-1-3-1.md diff --git a/exampleSite/content/toc-tree/level-2/_index.md b/exampleSite/content/en/toc-tree/level-2/_index.md similarity index 100% rename from exampleSite/content/toc-tree/level-2/_index.md rename to exampleSite/content/en/toc-tree/level-2/_index.md diff --git a/exampleSite/content/toc-tree/level-2/level-2-1.md b/exampleSite/content/en/toc-tree/level-2/level-2-1.md similarity index 100% rename from exampleSite/content/toc-tree/level-2/level-2-1.md rename to exampleSite/content/en/toc-tree/level-2/level-2-1.md diff --git a/exampleSite/content/toc-tree/level-2/level-2-2.md b/exampleSite/content/en/toc-tree/level-2/level-2-2.md similarity index 100% rename from exampleSite/content/toc-tree/level-2/level-2-2.md rename to exampleSite/content/en/toc-tree/level-2/level-2-2.md diff --git a/exampleSite/content/usage/_index.md b/exampleSite/content/en/usage/_index.md similarity index 100% rename from exampleSite/content/usage/_index.md rename to exampleSite/content/en/usage/_index.md diff --git a/exampleSite/content/usage/configuration.md b/exampleSite/content/en/usage/configuration.md similarity index 95% rename from exampleSite/content/usage/configuration.md rename to exampleSite/content/en/usage/configuration.md index c358a7b..d298000 100644 --- a/exampleSite/content/usage/configuration.md +++ b/exampleSite/content/en/usage/configuration.md @@ -61,11 +61,11 @@ enableRobotsTXT = true # You can also specify this parameter per page in front matter. 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. 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. # You can also specify this parameter per page in front matter. geekdocEditPath = "edit/main/exampleSite/content" @@ -174,11 +174,11 @@ params: # You can also specify this parameter per page in front matter. 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. 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. # You can also specify this parameter per page in front matter. geekdocEditPath: edit/main/exampleSite/content @@ -262,11 +262,11 @@ geekdocBreadcrumb = false # Set source repository location. 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. 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' geekdocFilePath = @@ -322,11 +322,11 @@ geekdocBreadcrumb: false # Set source repository location. 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. 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' geekdocFilePath: diff --git a/exampleSite/content/usage/getting-started.md b/exampleSite/content/en/usage/getting-started.md similarity index 100% rename from exampleSite/content/usage/getting-started.md rename to exampleSite/content/en/usage/getting-started.md diff --git a/exampleSite/content/usage/menus.md b/exampleSite/content/en/usage/menus.md similarity index 94% rename from exampleSite/content/usage/menus.md rename to exampleSite/content/en/usage/menus.md index 5761ce6..92f260a 100644 --- a/exampleSite/content/usage/menus.md +++ b/exampleSite/content/en/usage/menus.md @@ -33,7 +33,7 @@ content/ ## 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:** @@ -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. {{< /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:** @@ -97,7 +97,7 @@ more: ## 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:** diff --git a/exampleSite/data/menu/more.yaml b/exampleSite/data/menu/more.yaml index 04d7c61..8897653 100644 --- a/exampleSite/data/menu/more.yaml +++ b/exampleSite/data/menu/more.yaml @@ -7,7 +7,7 @@ more: ref: "https://github.com/thegeeklab/hugo-geekdoc/releases" external: true icon: "gdoc_download" - - name: "View Source" + - name: View Source ref: "https://github.com/thegeeklab/hugo-geekdoc" external: true icon: "gdoc_github" diff --git a/i18n/de.yaml b/i18n/de.yaml new file mode 100644 index 0000000..4ff1dc2 --- /dev/null +++ b/i18n/de.yaml @@ -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 Startseite. + +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 Hugo und + +footer_legal_notice: Impressum +footer_privacy_policy: Datenschutzerklärung + +language_switch_no_tranlation_prefix: "Seite nicht übersetzt:" diff --git a/i18n/en.yaml b/i18n/en.yaml new file mode 100644 index 0000000..9254e3d --- /dev/null +++ b/i18n/en.yaml @@ -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 homepage. + +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 Hugo and + +footer_legal_notice: Legal Notice +footer_privacy_policy: Privacy Policy + +language_switch_no_tranlation_prefix: "Page not translated:" diff --git a/layouts/404.html b/layouts/404.html index baf0b24..28df9a3 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -2,7 +2,7 @@ {{ partial "head/meta" . }} - Lost? Don't worry + {{ i18n "error_page_title" }} {{ partial "head/favicons" . }} {{ partial "head/others" . }} @@ -14,6 +14,7 @@
+ {{ partial "site-header" (dict "Root" . "MenuEnabled" false) }} @@ -23,11 +24,10 @@
-
Lost?
-
Error 404
+
{{ i18n "error_message_title" }}
+
{{ i18n "error_message_code" }}
- Seems like what you are looking for can't be found. Don't worry we can bring you back - to the homepage. + {{ i18n "error_message_text" .Site.BaseURL | safeHTML }}
diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index 64ed55c..48751dd 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -6,7 +6,7 @@
{{ .Text | safeHTML }} - + diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c165997..8133c86 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -39,7 +39,11 @@
{{ template "main" . }} - {{ partial "page-footer" . }} + + +
diff --git a/layouts/partials/foot.html b/layouts/partials/foot.html index 965fc4d..99dbffa 100644 --- a/layouts/partials/foot.html +++ b/layouts/partials/foot.html @@ -1,5 +1,6 @@ {{ if default true .Site.Params.GeekdocSearch }} - {{- $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 -}} {{ end }} diff --git a/layouts/partials/language.html b/layouts/partials/language.html new file mode 100644 index 0000000..845b92b --- /dev/null +++ b/layouts/partials/language.html @@ -0,0 +1,51 @@ +{{ if .Site.IsMultiLingual }} + +
    +
  • + {{ range .Site.Languages }} + {{ if eq . $.Site.Language }} + + + {{ .Lang | upper }} + + {{ end }} + {{ end }} + + + +
  • +
+
+{{ end }} diff --git a/layouts/partials/menu-bundle.html b/layouts/partials/menu-bundle.html index b4b1222..cc72b1d 100644 --- a/layouts/partials/menu-bundle.html +++ b/layouts/partials/menu-bundle.html @@ -27,6 +27,13 @@ {{ $id := substr (sha1 $this.Permalink) 0 8 }} {{ $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" }} + - {{ .name }} + {{ $name }} {{ if $doCollapse }} - + - {{ .name }} + {{ $name }} {{ end }} {{ with .sub }} diff --git a/layouts/partials/menu-extra.html b/layouts/partials/menu-extra.html index e444e81..3667836 100644 --- a/layouts/partials/menu-extra.html +++ b/layouts/partials/menu-extra.html @@ -15,8 +15,15 @@ {{ $isCurrent := eq $current $this }} {{ $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 }} - {{ 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 }} {{ if eq $target "header" }} @@ -30,7 +37,7 @@ class="gdoc-header__link" > - {{ .name }} + {{ $name }} diff --git a/layouts/partials/menu-filetree.html b/layouts/partials/menu-filetree.html index f98c6d1..2e1dfe3 100644 --- a/layouts/partials/menu-filetree.html +++ b/layouts/partials/menu-filetree.html @@ -77,10 +77,10 @@ {{ partial "title" . }} {{ end }} {{ if $doCollapse }} - + - + {{ end }} diff --git a/layouts/partials/page-footer.html b/layouts/partials/menu-nextprev.html similarity index 53% rename from layouts/partials/page-footer.html rename to layouts/partials/menu-nextprev.html index 23a01f2..0af61ac 100644 --- a/layouts/partials/page-footer.html +++ b/layouts/partials/menu-nextprev.html @@ -22,8 +22,15 @@ {{ $this := $site.GetPage .ref }} {{ $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" }} - {{ $current.Scratch.Set "nextPage" (dict "name" .name "this" $this) }} + {{ $current.Scratch.Set "nextPage" (dict "name" $name "this" $this) }} {{ $current.Scratch.Set "getNext" false }} {{ end }} @@ -32,7 +39,7 @@ {{ $current.Scratch.Set "getNext" true }} {{ end }} - {{ $current.Scratch.Set "prev" (dict "name" .name "this" $this) }} + {{ $current.Scratch.Set "prev" (dict "name" $name "this" $this) }} {{ end }} {{ $sub := default false .sub }} @@ -42,33 +49,30 @@ {{ end }} {{ end }} - - +{{ $showPrevNext := (and (default true .Site.Params.GeekdocNextPrev) .Site.Params.GeekdocMenuBundle) }} +{{ if $showPrevNext }} + + {{ with ($current.Scratch.Get "prevPage") }} + + gdoc_arrow_left_alt + {{ .name }} + + {{ end }} + + + {{ with ($current.Scratch.Get "nextPage") }} + + {{ .name }} + gdoc_arrow_right_alt + + {{ end }} + +{{ end }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 915f9e3..272916d 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -3,7 +3,7 @@
-

Navigation

+

{{ i18n "nav_navigation" }}

{{ if .Site.Params.GeekdocMenuBundle }} {{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.main.main) }} {{ else }} @@ -13,7 +13,7 @@ {{ if and (in (slice "posts" "tags") .Section) (default false .Site.Params.GeekdocTagsToMenu) }}
-

Tags

+

{{ i18n "nav_tags" }}

    {{ $currentPage := .RelPermalink }} {{ range $name, $taxonomy := .Site.Taxonomies.tags }} @@ -35,7 +35,7 @@
    {{ if .Site.Data.menu.more.more }} -

    More

    +

    {{ i18n "nav_more" }}

    {{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.more.more) }} {{ end }}
    diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html index 36e2572..bef099e 100644 --- a/layouts/partials/page-header.html +++ b/layouts/partials/page-header.html @@ -49,7 +49,7 @@ - Edit this page + {{ i18n "edit_page" }}
diff --git a/layouts/partials/posts/metadata.html b/layouts/partials/posts/metadata.html index 0a5c87c..ef1757e 100644 --- a/layouts/partials/posts/metadata.html +++ b/layouts/partials/posts/metadata.html @@ -3,7 +3,7 @@