Skip to content

jaywhj/mkdocs-document-dates

Repository files navigation

mkdocs-document-dates

English | 简体中文


A new generation MkDocs plugin for displaying exact creation date, last updated date, authors, email of documents

render

Features

  • Always displays exact meta information of the document and works in any environment (no-Git, Git environments, Docker, all CI/CD build systems, etc.)
  • Support list display of recently updated documents (in descending order of update date)
  • Support for manually specifying date and author in Front Matter
  • Support for multiple date formats (date, datetime, timeago)
  • Support for multiple author modes (avatar, text, hidden)
  • Support for manually configuring author's name, link, avatar, email, etc.
  • Flexible display position (top or bottom)
  • Elegant styling (fully customizable)
  • Multi-language support, localization support, intelligent recognition of user language, automatic adaptation
  • Ultimate build efficiency: O(1), no need to set the env var !ENV to distinguish runs
Build Speed Comparison: 100 md: 1000 md: Time Complexity:
git-revision-date-localized
git-authors
> 3 s > 30 s O(n)
document-dates < 0.1 s < 0.15 s O(1)

Installation

pip install mkdocs-document-dates

Configuration

Just add the plugin to your mkdocs.yml:

plugins:
  - document-dates

Or, full configuration:

plugins:
  - document-dates:
      position: top            # Display position: top(after title) bottom(end of document), default: top
      type: date               # Date type: date datetime timeago, default: date
      exclude:                 # List of excluded files
        - temp.md                  # Example: exclude the specified file
        - blog/*                   # Example: exclude all files in blog folder, including subfolders
      date_format: '%Y-%m-%d'  # Date format strings (e.g., %Y-%m-%d, %b %d, %Y)
      time_format: '%H:%M:%S'  # Time format strings (valid only if type=datetime)

Customization Settings

In addition to the above basic configuration, the plug-in also provides a wealth of customization options to meet a variety of individual needs:

  • Specify Datetime: Introduces the mechanism for obtaining document dates and methods for personalized customization, you can manually specify the creation date and last updated date for each document
  • Specify Author: Introduces the mechanism for obtaining document authors and methods for personalized customization, you can manually specify the author information for each document, such as name, link, avatar, email, etc.
  • Specify Avatar: You can manually specify the avatar for each author, support local file path and URL path
  • Configuration Structure and Style: You can freely configure the plugin's display structure in mkdocs.yml or Front Matter. You can quickly set the plugin styles through preset entrances, such as icons, themes, colors, fonts, animations, dividing line and so on
  • Use Template Variables: Can be used to optimize sitemap.xml for site SEO; Can be used to re-customize plug-ins, etc.
  • Add Recently Updated Module: Enable list of recently updated documents (in descending order of update date), this is ideal for sites with a large number of documents, so that readers can quickly see what's new
  • Add Localization Language: More localization languages for timeago and tooltip
  • Other Tips: Introducing the Do's of using plugin in Docker
  • Development Stories: Describes the origin of the plug-in, the difficulties and solutions encountered in development, and the principles and directions of product design

See the documentation for details: https://jaywhj.netlify.app/document-dates-en


Other Projects

  • MaterialX, the next generation of mkdocs-material, is based on mkdocs-material-9.7.0 and is named X. I'll be maintaining this branch continuously (since mkdocs-material will stop being maintained). Updates have been released that refactor and add a lot of new features, see https://github.com/jaywhj/mkdocs-materialx/releases/

Chat Group

Discord: https://discord.gg/cvTfge4AUy

Wechat:

About

A new generation MkDocs plugin for displaying exact creation date, last update date, authors, email of documents

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •