Add docs and documentation page #3

This commit is contained in:
david-swift 2025-03-18 15:28:36 +01:00
parent befcb0bba6
commit 9e653774c6
6 changed files with 187 additions and 1 deletions

View File

@ -141,8 +141,8 @@ show_repo = true
links = [ links = [
{ url = "@/blog/_index.md", name = "Blog" }, { url = "@/blog/_index.md", name = "Blog" },
{ url = "@/subprojects/_index.md", name = "Subprojects" }, { url = "@/subprojects/_index.md", name = "Subprojects" },
{ url = "@/docs/_index.md", name = "Docs" },
{ url = "@/demo/index.md", name = "Demo" }, { url = "@/demo/index.md", name = "Demo" },
{ url = "https://mastodon.de/@david_swift", name = "Developer" }
] ]
[extra.footer] [extra.footer]

6
content/docs/_index.md Normal file
View File

@ -0,0 +1,6 @@
+++
title = "Docs"
sort_by = "weight"
template = "docs.html"
page_template = "documentation_page.html"
+++

View File

@ -0,0 +1,6 @@
+++
weight = 1
title = "Overview"
+++
This is overview's content!

View File

@ -0,0 +1,6 @@
+++
weight = 1
title = "Page 2"
+++
Another page

46
templates/docs.html Normal file
View File

@ -0,0 +1,46 @@
{% extends "base.html" %}
{% block content %}
<h1>{{ section.title }}</h1>
{{ section.content | safe }}
{# <div class="sparkline">
{%- if paginator.pages -%}
{%- set pages = paginator.pages -%}
{%- elif section.pages -%}
{%- set pages = section.pages -%}
{%- else -%}
{%- set pages = term.pages -%}
{%- endif -%}
{%- for month, pages in pages | group_by(attribute="month") -%}
{%- set posts_per_bar = pages | length -%}
{%- set bar_height = pages | length * 10 -%}
<div style="--bar-height: {{ bar_height ~ '%' }}" title="{{ macros_translate::translate(key='posts', number=posts_per_bar, default='$NUMBER posts in total', language_strings=language_strings) }}"></div>
{%- endfor -%}
</div> #}
{% include "partials/subprojects.html" %}
{%- if paginator.pages -%}
<nav id="paginator">
{%- if paginator.previous -%}
<a id="paginator-previous" href="{{ paginator.previous }}">
<i class="icon"></i>
<div>{{ macros_translate::translate(key='previous', default='Previous', language_strings=language_strings) }}</div>
</a>
{%- endif -%}
<div></div>
{%- if paginator.next -%}
<a id="paginator-next" href="{{ paginator.next }}">
<div>{{ macros_translate::translate(key='next', default='Next', language_strings=language_strings) }}</div>
<i class="icon"></i>
</a>
{%- endif -%}
</nav>
{%- endif -%}
{% endblock content %}

View File

@ -0,0 +1,122 @@
{% extends "base.html" %}
{% block content %}
{%- set rel_attributes = macros_rel_attributes::rel_attributes() | trim -%}
{%- if page.extra.toc_ordered or section.extra.toc_ordered or config.extra.toc_ordered -%}
{%- set list_element = "ol" -%}
{%- else -%}
{%- set list_element = "ul" -%}
{%- endif -%}
<article>
{%- if page.extra.banner -%}
<div id="banner-container">
<img id="banner" class="full-bleed{% if page.extra.banner_pixels %} pixels{% endif %}" src="{{ current_url ~ page.extra.banner }}" {% if config.markdown.lazy_async_image %}decoding="async" loading="lazy"{% endif %} />
</div>
{%- endif -%}
<div id="heading">
<h1>{{ page.title }}</h1>
{%- if page.authors or config.extra.show_reading_time -%}
<p>
<small>
{%- if page.authors -%}
<span>{% include "partials/authors.html" -%}</span>
{%- if config.extra.show_reading_time -%}
<span> {{ config.extra.separator | default(value="•") }} </span>
{%- endif -%}
{%- endif -%}
{%- if config.extra.show_reading_time -%}
<span>{{ macros_translate::translate(key="minutes_read", number=page.reading_time, default="$NUMBER minute read", language_strings=language_strings) }}</span>
{%- if page.taxonomies -%}
<span> {{ config.extra.separator | default(value="•") }} </span>
{%- endif -%}
{%- endif -%}
</small>
</p>
{%- endif -%}
{%- if page.taxonomies -%}
{%- for name, taxon in page.taxonomies %}
<ul class="tags">
{%-for item in taxon -%}
<li><a class="tag" href="{{ get_taxonomy_url(kind=name, name=item, lang=lang) }}">{{ item }}</a></li>
{%- endfor %}
</ul>
{%- endfor -%}
{%- endif %}
</div>
<div id="buttons-container">
{%- if page.extra.toc and page.toc | length > 0 -%}
<details id="toc" class="closable">
<summary title="{{ macros_translate::translate(key='table_of_contents', default='Table of Contents', language_strings=language_strings) }}"><i class="icon"></i></summary>
<div>
<strong class="title">{{ macros_translate::translate(key="table_of_contents", default="Table of Contents", language_strings=language_strings) }}</strong>
<div>
<{{ list_element }}>
{%- for h1 in page.toc -%}
<li>
<a href="{{ h1.permalink | safe }}">{{ h1.title }}</a>
{%- if h1.children -%}
<{{ list_element }}>
{%- for h2 in h1.children -%}
<li>
<a href="{{ h2.permalink | safe }}">{{ h2.title }}</a>
</li>
{%- endfor -%}
</{{ list_element }}>
{%- endif -%}
</li>
{%- endfor -%}
</{{ list_element }}>
</div>
</div>
</details>
{%- endif -%}
{%- if config.extra.show_backlinks and page.backlinks | length > 0 -%}
<details id="backlinks" class="closable">
<summary title="{{ macros_translate::translate(key='backlinks', default='Backlinks', language_strings=language_strings) }}"><i class="icon"></i></summary>
<div>
<strong class="title">{{ macros_translate::translate(key="backlinks", default="Backlinks", language_strings=language_strings) }}</strong>
<div>
<ul>
{%- for backlink in page.backlinks -%}
<li>
<a href="{{ backlink.permalink }}">{{ backlink.title }}</a>
</li>
{%- endfor -%}
</ul>
</div>
</div>
</details>
{%- endif -%}
<a id="go-to-top" href="#top" title="{{ macros_translate::translate(key='go_to_top', default='Go to Top', language_strings=language_strings) }}"><i class="icon"></i></a>
{%- if config.extra.show_share_button -%}
<a id="share" href="https://shareopenly.org/share/?url={{ page.permalink }}{% if page.description %}&text={{ page.description | urlencode }}{% endif %}" rel="{{ rel_attributes }}" title="{{ macros_translate::translate(key='share', default='Share', language_strings=language_strings) }}"><i class="icon"></i></a>
{%- endif -%}
{%- if config.extra.issues_url -%}
<a id="issue" href="{{ config.extra.issues_url }}" rel="{{ rel_attributes }}" title="{{ macros_translate::translate(key='file_an_issue', default='File an Issue', language_strings=language_strings) }}"><i class="icon"></i></a>
{%- endif -%}
</div>
{%- include "partials/statements.html" -%}
{%- if page.extra.toc_inline -%}
{%- include "partials/toc.html" -%}
{%- elif config.extra.toc_inline -%}
{%- include "partials/toc.html" -%}
{%- endif -%}
{{ page.content | safe }}
</article>
{%- if page.extra.comments.id -%}
{%- include "partials/comments.html" -%}
{%- endif -%}
{% endblock content %}