Add sections to docs #3

This commit is contained in:
david-swift 2025-03-25 14:27:51 +01:00
parent 0cd6f76e8c
commit 6c9da90f7a
5 changed files with 34 additions and 4 deletions

View File

@ -3,4 +3,9 @@ title = "Docs"
sort_by = "weight" sort_by = "weight"
template = "docs.html" template = "docs.html"
page_template = "documentation_page.html" page_template = "documentation_page.html"
[extra]
sections = [
"More"
]
+++ +++

View File

@ -0,0 +1,8 @@
+++
weight = 2
title = "Details"
[extra]
section = 1
+++
This is overview's content!

View File

@ -1,6 +1,8 @@
+++ +++
weight = 1 weight = 0
title = "Overview" title = "Overview"
[extra]
section = 0
+++ +++
This is overview's content! This is overview's content!

View File

@ -1,6 +1,8 @@
+++ +++
weight = 1 weight = 1
title = "Page 2" title = "Page 2"
[extra]
section = 1
+++ +++
Another page Another page

View File

@ -1,7 +1,20 @@
<div id="docs"> <div id="docs">
{%- for page in section.pages %} {%- for page in section.pages %}
{%- if page.extra.section == 0 %}
<li>
<a href="{{ page.permalink | safe }}">{{ page.title }}</a>
</li>
{%- endif %}
{%- endfor %}
{%- for page_section, pages in section.pages | group_by(attribute="extra.section") %}
{% set int_section = page_section | int %}
{%- if int_section > 0 %}
<h3>{{ section.extra.sections | nth(n=int_section - 1) }}</h3>
{%- for page in pages %}
<li> <li>
<a href="{{ page.permalink | safe }}">{{ page.title }}</a> <a href="{{ page.permalink | safe }}">{{ page.title }}</a>
</li> </li>
{%- endfor %} {%- endfor %}
{%- endif %}
{%- endfor %}
</div> </div>