Skip to content

Regression: not able to have .Site.Home as sidebar root by default anymoreΒ #2426

@zecakeh

Description

@zecakeh

Environment

  • Version of Docsy you are using: 0.13.0
  • How are you using Docsy? As a:
    • Hugo module
    • NPM module
    • Git submodule
    • Other:
  • Version of Hugo you are using (output of hugo version): hugo v0.153.3-179034abbb2f31793c553a311177e6d742118030+extended linux/amd64 BuildDate=2025-12-26T15:33:04Z VendorInfo=gohugoio
  • OS:
    • Linux
    • macOS
    • Windows
    • Other:

Problem

We have been using the docs type on our website, and the sidebar was defaulting to .Site.Home as root on all sections and subpages. After upgrading to 0.13.0 the sidebar root defaults to .FirstSection and it is not possible to get it to default to .Site.Home anymore without modifying the layout files.

I believe that the culprits are those lines:

  • $sidebarRoot defaults to .FirstSection in sidebar.html:
    {{ $sidebarRoot := .FirstSection -}}
  • The old default for $navRoot in sidebar-tree.html for the docs type which was set to .Site.Home is overriden by $sidebarRoot, which is always set because of the default in sidebar.html:
    {{ $navRoot := cond (and (ne .Params.toc_root true) (eq .Site.Home.Type "docs")) .Site.Home .FirstSection -}}
    {{ if $sidebarRoot -}}
    {{ $navRoot = $sidebarRoot -}}
    {{ end -}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions