This plug-in exposing all pages metadata in a single path!
Just follow the steps:
-
Add dependency on your
requirements.txt
:... mkdocs-expose-page-metadata==1.1.6
-
Enable plug-in on your
mkdocs.yml
:... plugins: - mkdocs-expose-page-metadata ...
-
Is possible to set these config parameters:
Parameter Type Description Default Value metadata_page_path str
Metadata page path metadata
metadata_page_name str
Metadata page name metadata.json
metadata_page_encode str
Metadata page encode utf-8
-
-
Create any metadata in your markdown, for example on
lorem-ipsum.md
:--- title: Some metadata title tags: - First Tag - Second Tag other-metadata: bla --- # Lorem Ipsum 1 Some text 1 # Lorem Ipsum 2 [meta]:<test> (Some text) [meta]:<first-middle-tags> (First middle tag value 1) [meta]:<first-middle-tags> (First middle tag value 2) Some text 2 ## Lorem Ipsum 2-1 [second-middle-tags]:<> (Second middle tag value 1) [second-middle-tags]:<> (Second middle tag value 2) Some text 2-1 ...
-
Build and run you project, for exemple, with
mkdocs serve
command; -
Check all page metadata in a single endpoint:
/metadata/metadata.json
:[ { "meta" : { "title": "Some metadata title", "tags": [ "First Tag", "Second Tag" ], "other-metadata": "bla" }, "title": "Lorem Ipsum", "location": "/lorem-ipsum" }, { "meta" : { "test": "Some text", "first-middle-tags": [ "First middle tag value 1", "First middle tag value 2" ] }, "title": "Lorem Ipsum 2", "location": "/lorem-ipsum/#lorem-ipsum-2" }, { "meta" : { "second-middle-tags": [ "Second middle tag value 1", "Second middle tag value 2" ] }, "title": "Lorem Ipsum 2-1", "location": "/lorem-ipsum/#lorem-ipsum-2-1" } ]