mkdocs-backlinks
This is a plugin for adding backlinks to your mkdocs generated pages.
Mkdocs is an awesome tool not only for documentation, but also for publishing digital gardens. Backlinks are a desirable component when building such digital gardens, as they enable the ability to explore content based on how the knowledge interconnects instead of just looking at page navigation.
Setup
Install the plugin using pip:
pip install mkdocs-backlinks
Activate the plugin in mkdocs.yml:
plugins:
- mkdocs-backlinks
Note: If you have no
pluginsentry in your config file yet, you'll likely also want to add thesearchplugin. MkDocs enables it by default if there is nopluginsentry set, but now you have to enable it explicitly.
More information about plugins in the MkDocs documentation.
Config
ignored_pages- A list of page titles that will be excluded from the backlinks.
plugins:
- mkdocs-backlinks:
ignored_pages: [ 'Tags', 'Home' ]
Usage
This plugin will add a backlinks attribute to the Jinja page context, which can be used to add backlinks at any point
in your template. Here is an example of it:
...
{% if backlinks %}
<h3>Backlinks:</h3>
<ul>
{% for backlink in backlinks %}
<li><a href="/{{ backlink.url }}">{{ backlink.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
...
That means you need to have a template that supports backlinks, or you can alter the template you are using with the snippet above.
Writing Notes
I have been using this to publish my Obsidian vault, and there are some tricks to make it work well:
- Obsidian is smart and will resolve links even if they don´t refer to a valid file path. This is not true for mkdocs and the backlinks plugin -- you need to write valid links in your markdown files, either absolute or relative links.
- Absolute links are absolute related to the root of the
/docsfolder, not to your computer filesystem.
Following those two rules will allow you to go straight from obsidian to mkdocs with cool backlinks.
See Also
More information about templates here.
More information about blocks here.
Thanks to
- The creator of this awsome mkdocs plugin template: https://github.com/byrnereese/mkdocs-plugin-template
Metadata
Release files for mkdocs-backlinks 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs-backlinks-0.9.1.tar.gz | 5.7 kB | Without provenance | Details for mkdocs-backlinks-0.9.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_backlinks-0.9.1-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_backlinks-0.9.1-py3-none-any.whl |
Total release size: 11.8 kB
Release files / mkdocs-backlinks-0.9.1.tar.gz
| Download URL | mkdocs-backlinks-0.9.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a1fefb4b7061948eccc0ad8b40cc34d729278f585e2a79b3ed8a3da050b80d6
|
|
BLAKE2b-256 checksum How to use checksums |
c4d976b85008dbcf5b61d7c3782009fe825715e7e321be52aa1674fc964e1070
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Release files / mkdocs_backlinks-0.9.1-py3-none-any.whl
| Download URL | mkdocs_backlinks-0.9.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71c80f2e14bc7cbddb431ea7f33e84a7b1acf85588b89a1cae2175f0157b998d
|
|
BLAKE2b-256 checksum How to use checksums |
2e4fd2d6b59ab492510d23864e04c3dfb7398433b4c5579ea1a1055bacc53159
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Security for mkdocs-backlinks 0.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.