From f2b37ae48769b7805d314806b4612eb170f648d2 Mon Sep 17 00:00:00 2001 From: Ivan Ogasawara Date: Thu, 2 Nov 2023 12:15:35 -0400 Subject: [PATCH] feat: Add template for sidebar menu (#69) --- mkdocs.yml | 5 ++ pages/programs/internship/2023-01.md | 1 - pages/programs/internship/cycles/2023-01.md | 9 +++ pages/programs/internship/guide/index.md | 0 .../{guide/guide.md => guides/index.md} | 1 + .../internship/guides/interns/index.md | 7 +++ .../internship/guides/mentors/index.md | 7 +++ pages/programs/internship/index.md | 1 + theme/base.html | 28 ++++++--- theme/home.html | 2 +- theme/single-sidebar.html | 63 +++++++++++++++++++ 11 files changed, 113 insertions(+), 11 deletions(-) delete mode 100644 pages/programs/internship/2023-01.md create mode 100644 pages/programs/internship/cycles/2023-01.md delete mode 100644 pages/programs/internship/guide/index.md rename pages/programs/internship/{guide/guide.md => guides/index.md} (81%) create mode 100644 pages/programs/internship/guides/interns/index.md create mode 100644 pages/programs/internship/guides/mentors/index.md create mode 100644 theme/single-sidebar.html diff --git a/mkdocs.yml b/mkdocs.yml index 87293b02..d5c4065e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -26,6 +26,11 @@ nav: - Ambassadors: 'programs/ambassadors/index.md' - Incubator: 'programs/incubator/index.md' - Internship: 'programs/internship/index.md' + # - Internship: + # - index: 'programs/internship/index.md' + # - "Mentors' Guide": 'programs/internship/guides/mentors/index.md' + # - "Interns' Guide": 'programs/internship/guides/interns/index.md' + # - "Cycle 2023-01": 'programs/internship/cycles/2023-01.md' - Mentoring: 'programs/mentoring/index.md' - "Package Support": 'programs/packaging-support/index.md' - Partners: 'programs/partners/index.md' diff --git a/pages/programs/internship/2023-01.md b/pages/programs/internship/2023-01.md deleted file mode 100644 index 411ff086..00000000 --- a/pages/programs/internship/2023-01.md +++ /dev/null @@ -1 +0,0 @@ -# Internship Program 2023 - 01 diff --git a/pages/programs/internship/cycles/2023-01.md b/pages/programs/internship/cycles/2023-01.md new file mode 100644 index 00000000..cda2065a --- /dev/null +++ b/pages/programs/internship/cycles/2023-01.md @@ -0,0 +1,9 @@ +--- +title: "OSL Internship Program Guideline" +description: "Internship Program Guideline" +date: "2023-10-30" +authors: ["OSL Team"] +template: single-sidebar.html +--- + +# Internship Program 2023 - 01 diff --git a/pages/programs/internship/guide/index.md b/pages/programs/internship/guide/index.md deleted file mode 100644 index e69de29b..00000000 diff --git a/pages/programs/internship/guide/guide.md b/pages/programs/internship/guides/index.md similarity index 81% rename from pages/programs/internship/guide/guide.md rename to pages/programs/internship/guides/index.md index db8d777e..d185ba1e 100644 --- a/pages/programs/internship/guide/guide.md +++ b/pages/programs/internship/guides/index.md @@ -3,4 +3,5 @@ title: "OSL Internship Program Guideline" description: "Internship Program Guideline" date: "2023-10-30" authors: ["OSL Team"] +template: single-sidebar.html --- diff --git a/pages/programs/internship/guides/interns/index.md b/pages/programs/internship/guides/interns/index.md new file mode 100644 index 00000000..d185ba1e --- /dev/null +++ b/pages/programs/internship/guides/interns/index.md @@ -0,0 +1,7 @@ +--- +title: "OSL Internship Program Guideline" +description: "Internship Program Guideline" +date: "2023-10-30" +authors: ["OSL Team"] +template: single-sidebar.html +--- diff --git a/pages/programs/internship/guides/mentors/index.md b/pages/programs/internship/guides/mentors/index.md new file mode 100644 index 00000000..d185ba1e --- /dev/null +++ b/pages/programs/internship/guides/mentors/index.md @@ -0,0 +1,7 @@ +--- +title: "OSL Internship Program Guideline" +description: "Internship Program Guideline" +date: "2023-10-30" +authors: ["OSL Team"] +template: single-sidebar.html +--- diff --git a/pages/programs/internship/index.md b/pages/programs/internship/index.md index 4351f470..9f350ea3 100644 --- a/pages/programs/internship/index.md +++ b/pages/programs/internship/index.md @@ -3,6 +3,7 @@ title: "OSL Internship Program" description: "Internship Program about" date: "2023-08-24" authors: ["OSL Team"] +# template: single-sidebar.html --- # Open Science Labs Internship Program diff --git a/theme/base.html b/theme/base.html index afc56433..4f8548f1 100644 --- a/theme/base.html +++ b/theme/base.html @@ -1,3 +1,5 @@ +{% set menu_2nd_level_selected = [] %} + @@ -78,6 +80,9 @@
{% for nav_child in nav_item.children %} {% if nav_child.title != "index" %} + {% if nav_item.active and nav_item == nav_child.parent %} + {{ menu_2nd_level_selected.append(nav_child) or "" }} + {% endif %}
-

Open ScienceLabs,

+

Open Science Labs,

La comunidad abierta para la ciencia y tecnologĂ­a.

diff --git a/theme/single-sidebar.html b/theme/single-sidebar.html new file mode 100644 index 00000000..187fc78e --- /dev/null +++ b/theme/single-sidebar.html @@ -0,0 +1,63 @@ +{% extends "base.html" %} + +{% block header_extra %} + +{% endblock header_extra%} + +{% block content %} + +
+
+ {% block side_menu %} + + {# prepare the nav3 content inside the side block -#} + {% set nav3_selected = [] -%} + {% for nav1 in nav -%} + {% for nav2 in (nav1.children or []) -%} + {% if nav2.active %} + {% for nav3 in (nav2.children or []) -%} + {% if nav3.title != "index" -%} + {{ nav3_selected.append(nav3) or "" -}} + {% endif %} + {% endfor -%} + {% endif -%} + {% endfor -%} + {% endfor %} + +
+ +
+ {% for nav3_item in nav3_selected %} + + {{ nav3_item.title }} + + {% endfor %} +
+ + {% if menu_3rd_level_selected %} +
+ {% for menu_item_3rd_level in menu_3rd_level_selected %} +

+ {{ menu_item_3rd_level.title }} +

+ {% endfor %} +
+ {% endif %} +
+ {% endblock side_menu %} +
+ {% block content_inner %} + {{ page.content }} + {% endblock content_inner %} +
+
+
+{% endblock content %}