Creating another "child" section for docs sidebar

I have a docs site with a sidebar. Right now, I can press one “topic” on the left and everything inside that topic is a “child” to the topic.

I want to make so that the child has another child, if that makes sense (I dont know the terminology).

I am using the Compose template and have tried playing around with it. Most of the time I have been able to do what I want, but this is a bit too hard for me. I have tried to add another header element in the sidebar code, but I only get errors. I think the sidebar.html file in partials is where I have to modify it.

Sidebar.html is:

<aside class="aside">
  {{- template "tree" (dict "page" . "section" .FirstSection)  }}
  {{- define "tree" }}
  {{- $section := .section }}
  {{- $page := .page }}
  {{- $permalink := $page.RelPermalink }}
  <section class="section">
    <h2 class="section_title{{ if eq $section.RelPermalink $permalink }} active{{ end }}"><a  href="{{ $section.Permalink }}" class="group">{{ $section.Title }}</a></h2>
      {{- $pages := $section.Pages }}
      {{- with $pages }}
      <section class="" id="docs-{{ anchorize $section.Title }}">
        {{- range . }}
        {{- if .IsPage }}
        <h3 class="section_link{{ if eq .RelPermalink $permalink }} active{{ end }}"><a id="docs-{{ anchorize .Title }}" href="{{ .Permalink }}">{{ .Title }}</a></h3>
        {{- if ne (print .TableOfContents) ""}}
          {{- .TableOfContents }}
        {{- end }}
        {{- else }}
        {{- template "tree" (dict "page" $page "section" .) }}
        {{- end }}
        {{- end }}
      </section>
      {{- end }}
  </section>
  {{- end }}
</aside>

hi @boof

what have you tried so far? what happens if you create a ‘child’ folder under your ‘child’

your child would inherit the same HTML layouts as the content structure it sits under

1 Like

I had tried editing the code to add another “header” section, it did not occur to me that adding a folder with a new index would work. This solved my problem and was easier and more intuitive… thank you

Now I stumbled across another problem and this time I think it is related to the sidebar.html that I dont understand at all.

I will attach a photo so it becomes clearer. I want the “Årskurs x” “children” to be hidden until I navigate to “kemiteknik”. In the picture, I am navigated at “Navigera”, and yet the “Årskurs” are showing. Do you know how to fix this?test

for that you will probably need CSS / javascript and HTML skills

so look at the FAQ for the theme you are using and contact the theme support about menu

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.