diff --git a/content/docs/customize.md b/content/docs/customize.md index 739db79..d08f50c 100644 --- a/content/docs/customize.md +++ b/content/docs/customize.md @@ -6,7 +6,7 @@ weight = 12 The fast path is to change four things in `hugo.toml`: `baseURL`, `title`, `params.sidebarFooter`, and `params.homeFooter`. -Then adjust `menus.main`. The sidebar shape comes from the menu, so you do not need a special data file or extra config layer. +Then adjust `title` and `weight` in your content files. The sidebar shape comes from the section tree, so you do not need a special data file or a menu block for each page. If you want a different voice on the homepage, edit `content/_index.md`. If you want layout changes, start in `themes/starless/layouts/_default/baseof.html`. diff --git a/content/docs/files.md b/content/docs/files.md index 7acbd07..f3924b9 100644 --- a/content/docs/files.md +++ b/content/docs/files.md @@ -6,11 +6,11 @@ weight = 13 The files that matter are not hard to find. -- `hugo.toml` sets the theme, site title, footer text, and sidebar menu. -- `content/` holds the homepage and this short guide. +- `hugo.toml` sets the theme, site title, and footer text. +- `content/` holds the homepage and this short guide. Its section tree also drives the sidebar. - `themes/starless/layouts/_default/baseof.html` builds the page shell and the shared styling. - `themes/starless/layouts/partials/sidebar.html` renders the left rail. -- `themes/starless/layouts/partials/menu-tree.html` renders the nested menu links. +- `themes/starless/layouts/partials/menu-tree.html` renders the nested section and page links. - `themes/starless/layouts/_default/home.html`, `list.html`, and `single.html` handle the main content area. If you are trying to understand the theme, read those files in that order. There is not much else hiding off to the side. diff --git a/content/docs/install.md b/content/docs/install.md index 2e37a8c..4e7c111 100644 --- a/content/docs/install.md +++ b/content/docs/install.md @@ -8,6 +8,6 @@ If you fork this repo, you already have the theme and the demo site in one place If you want to drop Starless into another Hugo site, copy the `themes/starless/` folder into that project and set `theme = "starless"` in `hugo.toml`. -After that, add a small `menus.main` block so the sidebar has something to render. The current config in this repo is enough to copy and trim. +After that, add an `_index.md` for each section you want listed and set `weight` in front matter to control order. The sidebar follows the `content/` tree automatically. Run `hugo server` and edit from there. The theme is simple enough that most changes show up where you expect. diff --git a/hugo.toml b/hugo.toml index ecb6e9b..c7426df 100644 --- a/hugo.toml +++ b/hugo.toml @@ -22,32 +22,3 @@ inline = [["\\(", "\\)"]] description = "Starless is a small Hugo theme for dark, text first sites." sidebarFooter = "Built with Hugo." homeFooter = "Small on purpose." - -[[menus.main]] -name = "Guide" -pageRef = "/docs" -weight = 10 - -[[menus.main]] -name = "Install" -pageRef = "/docs/install" -parent = "Guide" -weight = 11 - -[[menus.main]] -name = "Customize" -pageRef = "/docs/customize" -parent = "Guide" -weight = 12 - -[[menus.main]] -name = "Files" -pageRef = "/docs/files" -parent = "Guide" -weight = 13 - -[[menus.main]] -name = "How it looks?" -pageRef = "/docs/how-it-looks" -parent = "Guide" -weight = 14 diff --git a/themes/starless/layouts/partials/menu-tree.html b/themes/starless/layouts/partials/menu-tree.html index af4fb2f..8ac485d 100644 --- a/themes/starless/layouts/partials/menu-tree.html +++ b/themes/starless/layouts/partials/menu-tree.html @@ -1,29 +1,33 @@ -{{- range .ByWeight -}} -
- - {{ if .HasChildren }}expand_more{{ else }}chevron_right{{ end }} - {{ .Name }} - - {{- with .Children -}} -
- {{- range .ByWeight -}} - {{- if .HasChildren -}} -
- - expand_more - {{ .Name }} - -
- {{ range .Children.ByWeight }} - {{ .Name }} - {{ end }} -
-
- {{- else -}} - {{ .Name }} - {{- end -}} +{{- range .nodes.ByWeight -}} + {{- if eq $.level 0 -}} +
+ + {{ if .IsSection }}expand_more{{ else }}chevron_right{{ end }} + {{ .LinkTitle }} + + {{- if .IsSection -}} + {{- with .Pages.ByWeight -}} +
+ {{ partial "menu-tree.html" (dict "nodes" . "level" (add $.level 1)) }} +
+ {{- end -}} + {{- end -}} +
+ {{- else -}} + {{- if .IsSection -}} +
+ + expand_more + {{ .LinkTitle }} + + {{- with .Pages.ByWeight -}} +
+ {{ partial "menu-tree.html" (dict "nodes" . "level" (add $.level 1)) }} +
{{- end -}}
+ {{- else -}} + {{ .LinkTitle }} {{- end -}} -
+ {{- end -}} {{- end -}} diff --git a/themes/starless/layouts/partials/sidebar.html b/themes/starless/layouts/partials/sidebar.html index 11647c5..7955173 100644 --- a/themes/starless/layouts/partials/sidebar.html +++ b/themes/starless/layouts/partials/sidebar.html @@ -9,8 +9,8 @@