mkdocs-footermatter


Namemkdocs-footermatter JSON
Version 1.4.0 PyPI version JSON
download
home_page
SummaryA plugin to extract authors, created date and updated date from YAML frontmatter
upload_time2023-12-17 11:11:46
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords mkdocs markdown footer author edited created frontmatter obsidian
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # mkdocs-footermatter (Working title)
[![Build Status](https://img.shields.io/github/actions/workflow/status/sondregronas/mkdocs-footermatter/CI.yml?branch=main)](https://github.com/sondregronas/mkdocs-footermatter/)
[![GitHub latest commit](https://img.shields.io/github/last-commit/sondregronas/mkdocs-footermatter)](https://github.com/sondregronas/mkdocs-footermatter/commit/)
[![PyPi](https://img.shields.io/pypi/v/mkdocs-footermatter)](https://pypi.org/project/mkdocs-footermatter/)
![MIT license](https://img.shields.io/github/license/sondregronas/mkdocs-footermatter)
[![codecov](https://codecov.io/gh/sondregronas/mkdocs-footermatter/branch/main/graph/badge.svg?token=N5IDI7Q4NZ)](https://codecov.io/gh/sondregronas/mkdocs-footermatter)

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](img.png)

Inspired by [git-revision-date-localized](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin) and [mkdocs-git-committers-plugin](https://github.com/ojacques/mkdocs-git-committers-plugin-2), without the need of using git logs.

## Setup
Install the plugin using pip:

`pip install mkdocs-footermatter`

Activate the plugin in `mkdocs.yml`:

```yaml
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](https://github.com/beaussan/update-time-on-edit-obsidian)

Example frontmatter:

```markdown
---
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](https://pendulum.eustace.io/) 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](https://pendulum.eustace.io/docs/#tokens). Example: `MMMM YYYY` = January 2022

## Template
An example setup can be seen in the [overrides](https://github.com/sondregronas/mkdocs-footermatter/tree/main/overrides) folder, including some css styling and an example [main.html](https://github.com/sondregronas/mkdocs-footermatter/blob/main/overrides/main.html)

Relevant context values:
```yaml
{{ footermatter_updated }}
{{ footermatter_created }}
{%- for author in footermatter_authors -%}
    {{ author.name }}
    {{ author.img }} 
    {{ base_url }}/{{ author.img }}
    {{ author.url }}
{%- endfor -%}
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mkdocs-footermatter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mkdocs,markdown,footer,author,edited,created,frontmatter,obsidian",
    "author": "",
    "author_email": "Sondre Gr\u00f8n\u00e5s <mail@sondregronas.com>",
    "download_url": "https://files.pythonhosted.org/packages/18/82/551c48b8b30c579e081db05eecfaa12d35041b551c83a161b3ab2283191b/mkdocs-footermatter-1.4.0.tar.gz",
    "platform": null,
    "description": "# mkdocs-footermatter (Working title)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/sondregronas/mkdocs-footermatter/CI.yml?branch=main)](https://github.com/sondregronas/mkdocs-footermatter/)\n[![GitHub latest commit](https://img.shields.io/github/last-commit/sondregronas/mkdocs-footermatter)](https://github.com/sondregronas/mkdocs-footermatter/commit/)\n[![PyPi](https://img.shields.io/pypi/v/mkdocs-footermatter)](https://pypi.org/project/mkdocs-footermatter/)\n![MIT license](https://img.shields.io/github/license/sondregronas/mkdocs-footermatter)\n[![codecov](https://codecov.io/gh/sondregronas/mkdocs-footermatter/branch/main/graph/badge.svg?token=N5IDI7Q4NZ)](https://codecov.io/gh/sondregronas/mkdocs-footermatter)\n\nA plug-in to extract `authors`, `created` and `updated` data from the YAML fronmatter to be rendered in a footer template.\n\nThis solves a problem I had when batch renaming every file inside a GitHub action which would overwrite the aforementioned logs. (Renaming `%20` to `-`)\n\n![img.png](img.png)\n\nInspired by [git-revision-date-localized](https://github.com/timvink/mkdocs-git-revision-date-localized-plugin) and [mkdocs-git-committers-plugin](https://github.com/ojacques/mkdocs-git-committers-plugin-2), without the need of using git logs.\n\n## Setup\nInstall the plugin using pip:\n\n`pip install mkdocs-footermatter`\n\nActivate the plugin in `mkdocs.yml`:\n\n```yaml\nplugins:\n  - search\n  - footermatter:\n      author_map:\n        - Firstname Lastname | assets/img/firstname.png | https://github.com/firstnamelastname\n        - Author2 | <path from \"custom_dir\"> | htts://github.com/author2\n```\n> **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.\n\n### Usage\nCan be used in conjunction with the Obsidian plug-in [update-time-on-edit-obsidian](https://github.com/beaussan/update-time-on-edit-obsidian)\n\nExample frontmatter:\n\n```markdown\n---\nauthors:\n  - Firstname Lastname\n  - Author2\ncreated: 2022-04-09 08:52:19\nupdated: 2022-08-13 12:18:05\n---\n```\n\n## Configuration options\n**Fronmatter keys:**\n- `key_authors` fronmatter syntax for authors. Default: `authors`\n- `key_created` frontmatter syntax for date created. Default: `created`\n- `key_updated` frontmatter syntax for date updated. Default: `updated`\n\n**Locale & format:**\n- `locale` language format for date_format (some options may require this to be configured, see below) fallbacks to theme language (recommended) or `en` \n- `date_format` What format to use for the dates, see below for options. Default: `date`\n- `timeago_absolute` Boolean to omit the `ago` text. True: `2 days`, False: `2 days ago`. Default: `True`\n\n**Author rendering options:**\n- `author_map` List of authors mapped image and url values: `name | img (path relative to \"custom_dir\" or url) | url/website`\n- `separator_map` separator for `author_map`. Default `|`\n- `default_author_img` fallback image if missing from `author_map`. Default `https://ui-avatars.com` (See template for details)\n- `default_author_url` fallback url if missing from `author_map`. Default: `/`\n\n## Date formats\nNote: values are static and only change when re-building your docs. All formats are localized using the [Pendulum](https://pendulum.eustace.io/) package\n- `timeago` (2 hours ago) - a readable, relative date format.\n- `date` (January 1. 2022) - simple date format (`LL`).\n- `datetime` (January 1. 2022 12:00 PM) - same as date, but with added timestamp (`LLL`)\n- For custom formats just pass [a valid pendulum string format](https://pendulum.eustace.io/docs/#tokens). Example: `MMMM YYYY` = January 2022\n\n## Template\nAn example setup can be seen in the [overrides](https://github.com/sondregronas/mkdocs-footermatter/tree/main/overrides) folder, including some css styling and an example [main.html](https://github.com/sondregronas/mkdocs-footermatter/blob/main/overrides/main.html)\n\nRelevant context values:\n```yaml\n{{ footermatter_updated }}\n{{ footermatter_created }}\n{%- for author in footermatter_authors -%}\n    {{ author.name }}\n    {{ author.img }} \n    {{ base_url }}/{{ author.img }}\n    {{ author.url }}\n{%- endfor -%}\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A plugin to extract authors, created date and updated date from YAML frontmatter",
    "version": "1.4.0",
    "project_urls": {
        "documentation": "https://github.com/sondregronas/mkdocs-footermatter",
        "funding": "https://github.com/sponsors/sondregronas",
        "homepage": "https://github.com/sondregronas/mkdocs-footermatter",
        "issues": "https://github.com/sondregronas/mkdocs-footermatter/issues",
        "repository": "https://github.com/sondregronas/mkdocs-footermatter"
    },
    "split_keywords": [
        "mkdocs",
        "markdown",
        "footer",
        "author",
        "edited",
        "created",
        "frontmatter",
        "obsidian"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba34495a266231d02b82411695d01dff2121629f3a7ea219fcb4916b8c3ac725",
                "md5": "8f2a5eec9efc4de82dbfc994f146ae85",
                "sha256": "d3075ce43024964c0d4b421d17b633c83a7763b82260ab94e4d70c6341e65498"
            },
            "downloads": -1,
            "filename": "mkdocs_footermatter-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8f2a5eec9efc4de82dbfc994f146ae85",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6433,
            "upload_time": "2023-12-17T11:11:44",
            "upload_time_iso_8601": "2023-12-17T11:11:44.667574Z",
            "url": "https://files.pythonhosted.org/packages/ba/34/495a266231d02b82411695d01dff2121629f3a7ea219fcb4916b8c3ac725/mkdocs_footermatter-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1882551c48b8b30c579e081db05eecfaa12d35041b551c83a161b3ab2283191b",
                "md5": "0d5672a88d8b0cd08ddfde9fe9c26768",
                "sha256": "fc98ffc63e6e1f3ba3878a8d460c6b54823cc52048417a9fab7ec42f7ecbc8ae"
            },
            "downloads": -1,
            "filename": "mkdocs-footermatter-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0d5672a88d8b0cd08ddfde9fe9c26768",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7135,
            "upload_time": "2023-12-17T11:11:46",
            "upload_time_iso_8601": "2023-12-17T11:11:46.282978Z",
            "url": "https://files.pythonhosted.org/packages/18/82/551c48b8b30c579e081db05eecfaa12d35041b551c83a161b3ab2283191b/mkdocs-footermatter-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-17 11:11:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sondregronas",
    "github_project": "mkdocs-footermatter",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "mkdocs-footermatter"
}
        
Elapsed time: 0.15405s