McShelby / hugo-theme-relearn

A theme for Hugo designed for documentation
https://mcshelby.github.io/hugo-theme-relearn/
MIT License
426 stars 186 forks source link

Lost the collapse icons, custom menu width issue? #814

Closed postb99 closed 7 months ago

postb99 commented 7 months ago

Hello,

Once I enabled the site history and rebuilt whole site, I could not find the menu item collapse/uncollapse icons so this is unpractical. What did I miss compared to the example site where the ">" icon is still there?

I really suspect it comes from menu custom width and arose only after I enabled site history.

I live with it for months ;)

baseURL = 'http://poesieland.free.fr/'
languageCode = 'fr-FR'
title = 'Poesieland'
# Add it only if you keep the theme in the `themes` directory.
# Remove it if you use the theme as a remote Hugo Module.
theme = "hugo-theme-relearn"
paginate = 5
defaultContentLanguage = 'fr'
enableEmoji = true
removePathAccents = true
cleanDestinationDir = true

[build]
buildStats = false

[params]
# This controls whether submenus will be expanded (true), or collapsed (false) in the
# menu; if no setting is given, the first menu level is set to false, all others to true;
# this can be overridden in the pages frontmatter
alwaysopen = false
# Prefix URL to edit current page. Will display an "Edit" button on top right hand corner of every page.
# Useful to give opportunity to people to create merge request for your doc.
# See the config.toml file from this documentation site to have an example.
editURL = ""
# Author of the site, will be used in meta information
author.name = "Barbara Post"
# Description of the site, will be used in meta information
description = "Barbara Post poésie poesieland"
# Shows a checkmark for visited pages on the menu
showVisitedLinks = true
# Disable search function. It will hide search bar
disableSearch = false
# Disable search in hidden pages, otherwise they will be shown in search box
disableSearchHiddenPages = false
# Disables hidden pages from showing up in the sitemap and on Google (et all), otherwise they may be indexed by search engines
disableSeoHiddenPages = false
# Disables hidden pages from showing up on the tags page although the tag term will be displayed even if all pages are hidden
disableTagHiddenPages = false
# Javascript and CSS cache are automatically busted when new version of site is generated.
# Set this to true to disable this behavior (some proxies don't handle well this optimization)
disableAssetsBusting = false
# Set this to true if you want to disable generation for generator version meta tags of hugo and the theme;
# don't forget to also set Hugo's disableHugoGeneratorInject=true, otherwise it will generate a meta tag into your home page
disableGeneratorVersion = false
# Set this to true to disable copy-to-clipboard button for inline code.
disableInlineCopyToClipBoard = true
# 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
disableBreadcrumb = false
disableRootBreadcrumb = true
# If set to true, hide table of contents menu in the header of all pages
disableToc = false
# If set to false, load the MathJax module on every page regardless if a MathJax shortcode is present
disableMathJax = true
# Specifies the remote location of the MathJax js
customMathJaxURL = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
# Initialization parameter for MathJax, see MathJax documentation
mathJaxInitialize = "{}"
# If set to false, load the Mermaid module on every page regardless if a Mermaid shortcode or Mermaid codefence is present
disableMermaid = true
# Specifies the remote location of the Mermaid js
customMermaidURL = "https://unpkg.com/mermaid/dist/mermaid.min.js"
# Initialization parameter for Mermaid, see Mermaid documentation
mermaidInitialize = "{ \"theme\": \"default\" }"
# If set to false, load the Swagger module on every page regardless if a Swagger shortcode is present
disableSwagger = true
# Specifies the remote location of the RapiDoc js
customSwaggerURL = "https://unpkg.com/rapidoc/dist/rapidoc-min.js"
# Initialization parameter for Swagger, see RapiDoc documentation
swaggerInitialize = "{ \"theme\": \"light\" }"
# Hide Next and Previous page buttons normally displayed full height beside content
disableNextPrev = false
# Order sections in menu by "weight" or "title". Default to "weight";
# this can be overridden in the pages frontmatter
ordersectionsby = "weight"
# Change default color scheme with a variant one. Eg. can be "auto", "red", "blue", "green" or an array like [ "blue", "green" ].
# themeVariant = [ "auto", "relearn-bright", "relearn-light", "relearn-dark", "learn", "neon", "blue", "green", "red" ]
  [[params.themeVariant]]
    identifier = "relearn-auto"
    name = "Relearn Light/Dark"
    auto = []
  [[params.themeVariant]]
    identifier = "relearn-light"
  [[params.themeVariant]]
    identifier = "relearn-dark"
  [[params.themeVariant]]
    identifier = "zen-auto"
    name = "Zen Light/Dark"
    auto = [ "zen-light", "zen-dark" ]
  [[params.themeVariant]]
    identifier = "zen-light"
  [[params.themeVariant]]
    identifier = "zen-dark"
  [[params.themeVariant]]
    identifier = "neon"
# Change the title separator. Default to "::".
titleSeparator = "-"
# If set to true, the menu in the sidebar will be displayed in a collapsible tree view. Although the functionality works with old browsers (IE11), the display of the expander icons is limited to modern browsers
collapsibleMenu = true
# If a single page can contain content in multiple languages, add those here
additionalContentLanguage = [ "en" ]
# If set to true, no index.html will be appended to prettyURLs; this will cause pages not
# to be servable from the file system
disableExplicitIndexURLs = false
# For external links you can define how they are opened in your browser; this setting will only be applied to the content area but not the shortcut menu
externalLinkTarget = "_blank"
themeVariantAuto = [ "relearn-light", "relearn-dark" ]
enableMissingTranslationPlaceholders = false

[params.relearn.dependencies]
  [params.relearn.dependencies.chartjs]
    name = "Chartjs"
    location = "header"

[params.imageEffects]
  border = false
  lightbox = false
  shadow = true

[outputs]
home = ["HTML", "SEARCH", "SEARCHPAGE"]
section = ["HTML"]
page = ["HTML", "PRINT"]

[Languages]
    [Languages.en]
        languageName = "English"
        contentDir = "content/en"
        title = "Poesieland"
        weight = 2
        [languages.en.params]
            landingPageName = "<i class='fas fa-home'></i> Home"

        [[Languages.en.menu.shortcuts]]
            name = "<i class='fa fas fa-feather-pointed'></i> My French poems"
            url = "../fr/"
            weight = 50
        [[Languages.en.menu.shortcuts]]
            name = "<i class='fas fa-fw fa-search'></i> Freetext search"
            url = "/search.html"
            weight = 55
        [[Languages.en.menu.shortcuts]]
            name = "<i class='fas fa-fw fa-bullhorn'></i> Credits"
            url = "/en/more/credits/"
            weight = 60
        [[Languages.en.menu.shortcuts]]
            name = "<i class='fa-brands fa-github'></i> Github"
            url = "https://github.com/postb99"
            weight = 70
        [[Languages.en.menu.shortcuts]]
            name = "<i class='fa-brands fa-linkedin'></i> LinkedIn"
            url = "https://www.linkedin.com/in/barbara-post-1b323714"
            weight = 80

    [Languages.fr]
        languageName = "Français"
        contentDir = "content/fr"
        title = "Poésieland"
        weight = 1
        [languages.fr.params]
            landingPageName = "<i class='fas fa-home'></i> Accueil"

        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fas fa-fw fa-tags'></i> Mots-clés"
            url = "/tags/"
            weight = 40
        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fas fa-fw fa-layer-group'></i> Catégories"
            url = "/categories/"
            weight = 50
        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fas fa-fw fa-search'></i> Recherche libre"
            url = "/search.html"
            weight = 50
        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fa fas fa-feather-pointed'></i> Mes poèmes anglophones"
            url = "../en/"
            weight = 55
        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fas fa-fw fa-bullhorn'></i> Crédits"
            url = "/more/credits/"
            weight = 60
        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fa-brands fa-github'></i> Github"
            url = "https://github.com/postb99"
            weight = 70
        [[Languages.fr.menu.shortcuts]]
            name = "<i class='fa-brands fa-linkedin'></i> LinkedIn"
            url = "https://www.linkedin.com/in/barbara-post-1b323714"
            weight = 80
McShelby commented 7 months ago

I recently came to the conclusion that TOML and YAML may be easy to get first but are both b...easts when it comes to more complex examples.

In your examples it comes down to the fact that you can't redefine subsections once you've left them.

The configuration you are looking for is collapsibleMenu and it belongs into `[params]'.

Your configuration is fine until you open a new section below the themeVariant parameter. After that you can't go back to add more options to params anymore.

So the block

# Change the title separator. Default to "::".
titleSeparator = "-"
# If set to true, the menu in the sidebar will be displayed in a collapsible tree view. Although the functionality works with old browsers (IE11), the display of the expander icons is limited to modern browsers
collapsibleMenu = true
# If a single page can contain content in multiple languages, add those here
additionalContentLanguage = [ "en" ]
# If set to true, no index.html will be appended to prettyURLs; this will cause pages not
# to be servable from the file system
disableExplicitIndexURLs = false
# For external links you can define how they are opened in your browser; this setting will only be applied to the content area but not the shortcut menu
externalLinkTarget = "_blank"
themeVariantAuto = [ "relearn-light", "relearn-dark" ]

must move up somewhere between [params] and [[params.themeVariant]].

enableMissingTranslationPlaceholders = false

is a Hugo top-level setting and must come before [build]