Skip to content

Section Overview links are not rendered in mega dropdowns and mobile navigation #307

Description

@h30s

Problem

In mkdocs.yml, all major sections (Projects, Opportunities, Partnership, Learning, About) and subsections define an "Overview" landing page (e.g. Projects -> Overview: projects/index.md).

In theme/base.html, the navbar templates check {% if ch.title in menu_group_titles %} to find the overview page and render:

  1. A prominent header link ({{ nav_item.title }} · Overview) with a divider at the top of the desktop mega dropdown:
    {# Optional Overview link for the section #}
    {% set parent_overview = None %}
    {% for ch in nav_item.children %}
      {% if ch.title in menu_group_titles %}
        {% set parent_overview = ch %}
      {% endif %}
    {% endfor %}
    {% if parent_overview %}
      <div class="px-2 pb-2">
        <a class="dropdown-item fw-semibold" href="{{ parent_overview.url|url }}">
          {{ nav_item.title }} · Overview
        </a>
      </div>
      <hr class="dropdown-divider my-2">
    {% endif %}
  2. The Overview item at the top of accordion subgroups:
    {% set child_overview = None %}
    {% for gc in child.children %}
      {% if gc.title in menu_group_titles %}
        {% set child_overview = gc %}
      {% endif %}
    {% endfor %}
  3. The parent Overview link at the top of expanded sections in mobile offcanvas:
    {# Parent Overview #}
    {% for ch in nav_item.children %}
      {% if ch.title in menu_group_titles %}
        <a class="nav-link py-1 {% if ch.active %}active{% endif %}" href="{{ ch.url|url }}">Overview</a>
      {% endif %}
    {% endfor %}

However, at line 2 of theme/base.html, menu_group_titles is set to:

{% set menu_group_titles = [''] %}

Because "Overview" is never matched in [''], parent_overview and child_overview are always None.

User Impact

  • Desktop mega dropdowns never render the prominent {{ nav_item.title }} · Overview landing link or divider at the top of any section menu.
  • Mobile navigation never renders the section Overview link at the top of expanded sections.
  • Overview pages are treated as generic child links instead of the primary section landing pages, making site navigation less intuitive.

Expected Behavior

menu_group_titles should include 'Overview' (e.g. {% set menu_group_titles = ['Overview', ''] %}) so that overview pages are properly detected and rendered at the top of navigation menus as intended.

Relevant Code References

  • theme/base.html (line 2, lines 147–161, lines 186–199, lines 311–316)
  • mkdocs.yml (lines 44–105)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions