Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is index.md supported? #78

Open
andre2007 opened this issue Oct 20, 2019 · 8 comments
Open

Is index.md supported? #78

andre2007 opened this issue Oct 20, 2019 · 8 comments

Comments

@andre2007
Copy link

Is the index.md feature supported as described here?

mkdocs/mkdocs#1139 (comment)

@chrissimpkins
Copy link
Owner

Not that I am aware of. It looks like Waylan described how to implement it in this SO thread: https://stackoverflow.com/questions/54596774/how-to-add-permalinks-to-tree-nodes-in-markdown-nav-file-mkdocs-yml/54598748#54598748

Please let us know if you come up with an approach!

@andre2007
Copy link
Author

My understanding is, there was a decision for a convention based approach to be implemented by the themes.

An index.md as first array element should be used as target, but not rendered as normal entry.

Why did you close the issue?

@chrissimpkins chrissimpkins reopened this Oct 20, 2019
@chrissimpkins
Copy link
Owner

Apologies. I interpreted this as a question about whether we support this as your title suggests.

@chrissimpkins
Copy link
Owner

chrissimpkins commented Oct 20, 2019

I don't closely follow the upstream project. If you are aware of conventions that are in place I would be happy to have a look and see how we can bring this into compliance with guidance.

@andre2007
Copy link
Author

This is a comment from @waylan I am referring to:

In the end, we settled on sorting pages so that an auto-generated nav would list an index file (index.md) as the first item within a parent with the expectation that themes could detect that and do something special with it (use it as the "folder level page"). In other words, MkDocs provides the mechanism for it to be possible as long as themes provide support to display it correctly. However, I'm not aware of any themes which have implemented support for it yet.

Source mkdocs/mkdocs#1139 (comment)

@chrissimpkins
Copy link
Owner

chrissimpkins commented Oct 21, 2019

For future reference, here is an implementation suggestion from Waylan:

{% if nav|length>1 %}
    <ul>
    {% for nav_item in nav %}
        {% if nav_item.children %}
            <li>{% if nav_item.children[0].is_index %}
                    <a href="{{ nav_item.children[0].url|url }}">{{ nav_item.title }}</a>
                {% else %}
                    {{ nav_item.title }}
                {% endif %}
                <ul>
                {% for nav_item in nav_item.children[1:] %}
                    <li class="{% if nav_item.active%}current{% endif %}">
                        <a href="{{ nav_item.url|url }}">{{ nav_item.title }}</a>
                    </li>
                {% endfor %}
                </ul>
            </li>
        {% else %}
            <li class="{% if nav_item.active%}current{% endif %}">
                <a href="{{ nav_item.url|url }}">{{ nav_item.title }}</a>
            </li>
        {% endif %}
    {% endfor %}
    </ul>
{% endif %} 

@andre2007
Copy link
Author

@chrissimpkins do you plan to implement this feature? When could it be available?

@chrissimpkins
Copy link
Owner

Unfortunately I won't be able to do it myself in the near term but would be happy to consider a pull request if anyone out there has an interest in it. I really apologize. I am just bogged down with higher priority work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants