Skip to content

current_page.ancestors only contains direct ancestor and not the full path of the page #693

Closed

Description

@rickpeters

I'm using the mkdocs theme and tried to enhance it with a breadcrumb trail. The page navigation is created automatically by mkdocs (I don't use the pages confguration since I have almost 300 pages).
I copied and adapted the breadcrumbs.html file from the readthedocs theme and integrated it in content.html:

<ol class="breadcrumb">
<li><a href="{{ homepage_url }}">Docs</a></li>
{% if current_page %}
  {% for doc in current_page.ancestors %}
    {% if doc.link %}
      <li><a href="{{ doc.link|e }}">{{ doc.title }}</a></li>
    {% else %}
      <li>{{ doc.title }}</li>
    {% endif %}
  {% endfor %}
{% endif %}
{% if current_page %}<li>{{ current_page.title }}</li>{% endif %}
</ol>

My file path (starting from the docs_dir) is:
beheerteam/diensten/algemeen/ActiveDirectory.md
The generated breadcrumb trail is:
Docs/algemeen/ActiveDirectory

algemeen is the only part that originates from the loop for doc in current_page.ancestors.

Maybe this is a stupid question or it is just not possible, but I couldn't find i in the documentation and I'm just starting with mkdocs and couldn't understand the source on how this works.

Activity

  1. added a commit that references this issue on Jul 25, 2015
    7ac5796
  2. added this to the 0.15.0 milestone on Jul 25, 2015
  3. d0ugal commented on Jul 25, 2015

    @d0ugal
    Contributor

    Confirmed the issue, I've got a fix which should resolve it - #694

  4. added a commit that references this issue on Jul 25, 2015
    e86e677
  5. reopened this on Jul 25, 2015
  6. d0ugal commented on Jul 25, 2015

    @d0ugal
    Contributor

    re-opening as it sounds like #694 may not have fixed all the things.

  7. d0ugal commented on Jan 19, 2016

    @d0ugal
    Contributor

    Okay, I've tested this and think it behaves as I expected.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions