Skip to content

Commit

Permalink
improve navigation of top-level sections; closes #791
Browse files Browse the repository at this point in the history
  • Loading branch information
bast committed Nov 18, 2024
1 parent 17e74cd commit a0b52e7
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 31 deletions.
2 changes: 1 addition & 1 deletion content/about/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
+++
title = "About the project"
template = "section-tree.html"
template = "about.html"
+++
2 changes: 1 addition & 1 deletion content/join/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
+++
title = "Why and how to join"
template = "section-tree.html"
template = "join.html"
+++
2 changes: 1 addition & 1 deletion content/workshops/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
+++
title = "Workshops and events"
template = "section-tree.html"
template = "workshops.html"
+++
10 changes: 10 additions & 0 deletions templates/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% import "macros.html" as macros %}

{% extends "base.html" %}

{% block content %}
<h1>{{ section.title }}</h1>

{% set data = load_data(path="content/navigation.yml") %}
{{ macros::section_tree(navigation=data.navigation, section="About") }}
{% endblock content %}
10 changes: 10 additions & 0 deletions templates/join.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% import "macros.html" as macros %}

{% extends "base.html" %}

{% block content %}
<h1>{{ section.title }}</h1>

{% set data = load_data(path="content/navigation.yml") %}
{{ macros::section_tree(navigation=data.navigation, section="Join") }}
{% endblock content %}
22 changes: 22 additions & 0 deletions templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,25 @@
</ul>
{% endif %}
{% endmacro toc %}

{% macro section_tree(navigation, section) %}
<div class="uk-margin-large">
<ul>

{% for link in navigation %}
{% if link.name == section %}
{% for subitem in link.items %}
<li>
{% if subitem.target is starting_with("http") %}
<a href="{{ subitem.target }}" target="_blank">{{ subitem.name }}</a>
{% else %}
<a href="{{ get_url(path=subitem.target) }}">{{ subitem.name }}</a>
{% endif %}
</li>
{% endfor %}
{% endif %}
{% endfor %}

</ul>
</div>
{% endmacro section_tree %}
28 changes: 0 additions & 28 deletions templates/section-tree.html

This file was deleted.

10 changes: 10 additions & 0 deletions templates/workshops.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{% import "macros.html" as macros %}

{% extends "base.html" %}

{% block content %}
<h1>{{ section.title }}</h1>

{% set data = load_data(path="content/navigation.yml") %}
{{ macros::section_tree(navigation=data.navigation, section="Workshops and events") }}
{% endblock content %}

0 comments on commit a0b52e7

Please sign in to comment.