Skip to main content

mkdocs-footermatter (Working title)

Build Status GitHub latest commit PyPi MIT license codecov

A plug-in to extract authors, created and updated data from the YAML fronmatter to be rendered in a footer template.

This solves a problem I had when batch renaming every file inside a GitHub action which would overwrite the aforementioned logs. (Renaming %20 to -)

img.png

Inspired by git-revision-date-localized and mkdocs-git-committers-plugin, without the need of using git logs.

Setup

Install the plugin using pip:

pip install mkdocs-footermatter

Activate the plugin in mkdocs.yml:

plugins:
  - search
  - footermatter:
      author_map:
        - Firstname Lastname | assets/img/firstname.png | https://github.com/firstnamelastname
        - Author2 | <path from "custom_dir"> | htts://github.com/author2

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

Usage

Can be used in conjunction with the Obsidian plug-in update-time-on-edit-obsidian

Example frontmatter:

---
authors:
  - Firstname Lastname
  - Author2
created: 2022-04-09 08:52:19
updated: 2022-08-13 12:18:05
---

Configuration options

Fronmatter keys:

  • key_authors fronmatter syntax for authors. Default: authors
  • key_created frontmatter syntax for date created. Default: created
  • key_updated frontmatter syntax for date updated. Default: updated

Locale & format:

  • locale language format for date_format (some options may require this to be configured, see below) fallbacks to theme language (recommended) or en
  • date_format What format to use for the dates, see below for options. Default: date
  • timeago_absolute Boolean to omit the ago text. True: 2 days, False: 2 days ago. Default: True

Author rendering options:

  • author_map List of authors mapped image and url values: name | img (path relative to "custom_dir" or url) | url/website
  • separator_map separator for author_map. Default |
  • default_author_img fallback image if missing from author_map. Default https://ui-avatars.com (See template for details)
  • default_author_url fallback url if missing from author_map. Default: /

Date formats

Note: values are static and only change when re-building your docs. All formats are localized using the Pendulum package

  • timeago (2 hours ago) - a readable, relative date format.
  • date (January 1. 2022) - simple date format (LL).
  • datetime (January 1. 2022 12:00 PM) - same as date, but with added timestamp (LLL)
  • For custom formats just pass a valid pendulum string format. Example: MMMM YYYY = January 2022

Template

An example setup can be seen in the overrides folder, including some css styling and an example main.html

Relevant context values:

{{ footermatter_updated }}
{{ footermatter_created }}
{%- for author in footermatter_authors -%}
    {{ author.name }}
    {{ author.img }} 
    {{ base_url }}/{{ author.img }}
    {{ author.url }}
{%- endfor -%}

Release files for mkdocs-footermatter 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocs-footermatter 1.4.0
File Size Uploaded
mkdocs-footermatter-1.4.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-footermatter 1.4.0
File Interpreter ABI Platform
mkdocs_footermatter-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / mkdocs-footermatter-1.4.0.tar.gz

Download URL mkdocs-footermatter-1.4.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fc98ffc63e6e1f3ba3878a8d460c6b54823cc52048417a9fab7ec42f7ecbc8ae
BLAKE2b-256 checksum
How to use checksums
1882551c48b8b30c579e081db05eecfaa12d35041b551c83a161b3ab2283191b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / mkdocs_footermatter-1.4.0-py3-none-any.whl

Download URL mkdocs_footermatter-1.4.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3075ce43024964c0d4b421d17b633c83a7763b82260ab94e4d70c6341e65498
BLAKE2b-256 checksum
How to use checksums
ba34495a266231d02b82411695d01dff2121629f3a7ea219fcb4916b8c3ac725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page