From 6cfd61e0f675b45ba85f8325e206d23a4337a14c Mon Sep 17 00:00:00 2001 From: mirisbowring Date: Wed, 21 Oct 2020 18:53:27 +0200 Subject: [PATCH] Navigation home option (#381) * enabled mermaid by default * implemented logic to use internal oder cdn mermaid * added english documentation * added french translation for the mermaid options * Removed useless test print * Hugo does not use upper case letters in params * fixed false sample link * improved mermaid pages * fixed always load mermaid if no frontmatter specified * applied 3 new params to default config * Implemented Home Button logic * Applied default style * applied same landingpage ref to logo partials * added sample image, how the button will looks like * added en documentation on how to configure the button * translated home button configuration to french via deepl * applied home button style to theme variants * set button disabled by default * fixed mermaid samples * removed obsolete css files * changed default version of mermaid cdn * renamed mermaidURL to customMermaidURL and removed css link * improved mermaid configuration description Co-authored-by: Arthur Ferdinand Lindner Co-authored-by: Arthur Ferdinand Lindner --- exampleSite/config.toml | 7 ++++ .../content/basics/configuration/_index.en.md | 35 ++++++++++++++++ .../content/basics/configuration/_index.fr.md | 39 ++++++++++++++++++ .../images/home_button_defaults.jpg | Bin 0 -> 9320 bytes exampleSite/layouts/partials/logo.html | 2 +- layouts/partials/logo.html | 2 +- layouts/partials/menu.html | 29 ++++++++----- static/css/theme-blue.css | 25 +++++++++-- static/css/theme-green.css | 27 +++++++++--- static/css/theme-red.css | 27 +++++++++--- static/css/theme.css | 7 ++++ 11 files changed, 174 insertions(+), 26 deletions(-) create mode 100755 exampleSite/content/basics/configuration/images/home_button_defaults.jpg diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 9f7ec53e35..c1381da479 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -15,6 +15,7 @@ defaultContentLanguageInSubdir= true showVisitedLinks = true disableBreadcrumb = false disableNextPrev = false + disableLandingPageButton = true disableMermaid = false customMermaidURL = "https://unpkg.com/mermaid@8.8.0/dist/mermaid.min.js" titleSeparator = "::" @@ -27,6 +28,8 @@ home = [ "HTML", "RSS", "JSON"] title = "Documentation for Hugo Learn Theme" weight = 1 languageName = "English" +landingPageURL = "/en" +landingPageName = " Home" [[Languages.en.menu.shortcuts]] name = " GitHub repo" @@ -54,6 +57,8 @@ weight = 30 title = "Documentation du thème Hugo Learn" weight = 2 languageName = "Français" +landingPageURL = "/fr" +landingPageName = " Accueil" [[Languages.fr.menu.shortcuts]] name = " Repo GitHub" @@ -81,6 +86,8 @@ weight = 30 title = "Hugo 主题的 Learn 文档" weight = 3 languageName = "简体中文" +landingPageURL = "/zh" +landingPageName = " 家" [[Languages.zh.menu.shortcuts]] name = " GitHub 仓库" diff --git a/exampleSite/content/basics/configuration/_index.en.md b/exampleSite/content/basics/configuration/_index.en.md index 7a804950a3..c46212524d 100644 --- a/exampleSite/content/basics/configuration/_index.en.md +++ b/exampleSite/content/basics/configuration/_index.en.md @@ -31,6 +31,9 @@ Note that some of these parameters are explained in details in other sections of disableInlineCopyToClipBoard = false # A title for shortcuts in menu is set by default. Set this to true to disable it. disableShortcutsTitle = false + # If set to false, a Home button will appear below the search bar on the menu. + # It is redirecting to the landing page of the current language if specified. (Default is "/") + disableLandingPageButton = true # When using mulitlingual website, disable the switch language button. disableLanguageSwitchingButton = false # Hide breadcrumbs in the header and only show the current page title @@ -75,3 +78,35 @@ The mermaid configuration parameters can also be set on a specific page. In this > On page "Architecture" you need a class diagram. You can set the mermaid parameters locally to only load mermaid on this page (not on the others). You also can disable mermaid for specific pages while globally enabled. + +## Home Button Configuration + +If the `disableLandingPage` option is set to `false`, an Home button will appear +on the left menu. It is an alternative for clicking on the logo. To edit the +appearance, you will have to configure two parameters for the defined languages: + +```toml +[Lanugages] +[Lanugages.en] +... +landingPageURL = "/en" +landingPageName = " Redirect to Home" +... +[Lanugages.fr] +... +landingPageURL = "/fr" +landingPageName = " Accueil" +... +``` + +If those params are not configured for a specific language, they will get their +default values: + +```toml +landingPageURL = "/" +landingPageName = " Home" +``` + +The home button is going to looks like this: + +![Default Home Button](/en/basics/configuration/images/home_button_defaults.jpg?width=100%) diff --git a/exampleSite/content/basics/configuration/_index.fr.md b/exampleSite/content/basics/configuration/_index.fr.md index 1cb5c97cbb..72e496da79 100644 --- a/exampleSite/content/basics/configuration/_index.fr.md +++ b/exampleSite/content/basics/configuration/_index.fr.md @@ -31,6 +31,9 @@ Notez que certains de ces paramètres sont expliqués en détails dans d'autres disableInlineCopyToClipBoard = false # Un titre est défini par défaut lorsque vous utilisez un raccourci dans le menu. Utilisez ce paramètre pour le cacher. disableShortcutsTitle = false + # S'il est réglé sur faux, un bouton Accueil apparaîtra sous la barre de recherche dans le menu. + # Il redirige vers la page d'accueil de la langue actuelle si cela est spécifié. (La valeur par défaut est "/") + disableLandingPageButton = true # Si défini à true, empêche Hugo d'inclure le module "mermaid" s'il n'est pas nécessaire (réduira les temps de chargement et le trafic) disableMermaid = false # Spécifie l'emplacement distant du mermaid js @@ -69,3 +72,39 @@ Les paramètres de configuration du mermaid peuvent également être définis su > À la page "Architecture", vous avez besoin d'un diagramme de classe. Vous pouvez régler les paramètres de mermaid localement pour ne charger que la sirène sur cette page (pas sur les autres). Vous pouvez également désactiver mermaid pour des pages spécifiques tout en l'activant globalement. +<<<<<<< HEAD + +## Configuration du bouton Accueil + +Si l'option `disableLandingPage` est définie sur `false`, un bouton +"Accueil" apparaîtra dans le menu de gauche. C'est une alternative pour cliquer +sur le logo. Pour modifier le vous devrez configurer deux paramètres pour les +langues définies : + +```toml +[Lanugages] +[Lanugages.en] +... +landingPageURL = "/en" +landingPageName = " Redirect to Home" +... +[Lanugages.fr] +... +landingPageURL = "/fr" +landingPageName = " Accueil" +... +``` + +Si ces paramètres ne sont pas configurés pour une langue spécifique, ils +obtiendront leur valeurs par défaut: + +```toml +landingPageURL = "/" +landingPageName = " Home" +``` + +Le bouton d'accueil va ressembler à ceci: + +![Default Home Button](/en/basics/configuration/images/home_button_defaults.jpg?width=100%) +======= +>>>>>>> 023fe7ef2b4c45fe66ac932d9e25d09f30b74a4e diff --git a/exampleSite/content/basics/configuration/images/home_button_defaults.jpg b/exampleSite/content/basics/configuration/images/home_button_defaults.jp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