vmware-tanzu-labs / educates-training-platform

A platform for hosting interactive workshop environments in Kubernetes, or on top of a local container runtime.
https://docs.educates.dev
Apache License 2.0
63 stars 15 forks source link

Allow creation of nested TOC entries when using Hugo. #358

Open GrahamDumpleton opened 2 months ago

GrahamDumpleton commented 2 months ago

Is your feature request related to a problem? Please describe.

All pages when using Hugo, whether or not they are nested within sections are rendered in a TOC with a flat namespace. I want to be able to override the structure of the TOC so that one can have pages listed under an entry for the section they are included in.

In other words, things might be displayed at the moment as:

* 1: page 1
* 2: section-1/page 1
* 3: section-1/page 2
* 4: page 2

This includes a page number intended only to illustrate that things are visited in that sequence.

What want to instead have is something like:

* page 1
* section-1
    + page 1
    + page 2
* page 2

Note that not showing numbers as before since not sure how they should be handled.

Describe the solution you'd like

As want to try and avoid mucking up TOC for existing workshops, propose that in order to trigger this behaviour when using Hugo renderer, that the section (branch bundle), needs to have a _index.md file which contains a title in the meta data.

---
title: Section Name
---

Note that to be practical might only support one level of nesting.

Describe alternatives you've considered

No response

Additional information

No response

GrahamDumpleton commented 2 months ago

From: https://kubernetes.slack.com/archives/C05UWT4SKRV/p1712670455033879

Suggestion is to use X.Y for page number prefix.

  1. Introductions
    1.1 Introduction to Git
    1.2 Introduction to Kubernetes
    1.3 Introduction to ArgoCD
  2. This is more tidy
  3. I like it a lot
GrahamDumpleton commented 2 months ago

One tricky part of supporting this is what to do if someone manually lists the pages in the workshop/config.yaml in a pathway and all pages under one section are not grouped together. One could simply ignore the fact and thus could end up with.

  1. Introductions
    1.1 Introduction to Git
    1.2 Introduction to Kubernetes
  2. This is more tidy
  3. Introductions
    3.1 Introduction to ArgoCD
  4. I like it a lot

Possibly just warn against it and if someone ignores that and results in repeating section name it is their issue.