Skip to content
Snippets Groups Projects
Commit c748f416 authored by jurgenhaas's avatar jurgenhaas
Browse files

#55 Add backlinks to the sidebar

parent e370b3a3
Branches
No related tags found
1 merge request!91Develop
Pipeline #1015772 passed
......@@ -9,7 +9,7 @@ services:
- 8999:8000
environment:
LIVE_RELOAD_SUPPORT: 'true'
ADD_MODULES: fontawesome-markdown mkdocs-git-revision-date-localized-plugin mkdocs-material==9.4.1 mkdocs-build-plantuml-plugin mkdocs-new-features-notifier mkdocs-git-authors-plugin markdown-include mkdocs-simple-hooks mkdocs-video tzdata
ADD_MODULES: fontawesome-markdown mkdocs-git-revision-date-localized-plugin mkdocs-material==9.4.1 mkdocs-build-plantuml-plugin mkdocs-new-features-notifier mkdocs-git-authors-plugin markdown-include mkdocs-simple-hooks mkdocs-video tzdata mkdocs-backlinks
FAST_MODE: 'true'
DOCS_DIRECTORY: /mkdocs
volumes:
......
......@@ -70,6 +70,8 @@ plugins:
- git-authors
- git-revision-date-localized:
type: datetime
- mkdocs-backlinks:
ignored_pages: [ 'Tags', 'Home' ]
- mkdocs-simple-hooks:
hooks:
on_config: "docs.hooks:append_nav"
......
{% set title = lang.t("toc") %}
{% if config.mdx_configs.toc and config.mdx_configs.toc.title %}
{% set title = config.mdx_configs.toc.title %}
{% endif %}
<nav class="md-nav md-nav--secondary" aria-label="{{ title }}">
{% set toc = page.toc %}
{% set first = toc | first %}
{% if first and first.level == 1 %}
{% set toc = first.children %}
{% endif %}
{% if toc %}
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
{{ title }}
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
{% for toc_item in toc %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>
{% endif %}
</nav>
{% if backlinks %}
<nav class="md-nav" aria-label="Backlinks">
<label class="md-nav__title" for="__backlinks">
<span class="md-nav__icon md-icon"></span>
Backlinks
</label>
<ul class="md-nav__list" data-md-component="backlinks" data-md-scrollfix>
{% for backlink in backlinks %}
<li class="md-nav__item">
<a href="/{{ backlink.url }}" class="md-nav__link">
{{ backlink.title }}
</a>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment