Skip to main content

A MkDocs plugin to list pages based on tags and folders

Project description

PageListPlugin for MkDocs

PageListPlugin is a plugin for MkDocs that dynamically generates lists of pages based on tags, folders, and other criteria directly within your markdown files. It's especially useful for creating dynamic references to other parts of your documentation based on shared tags or directory structure. It may need tweaking for your needs. The use of grouping by folders is helpful if you use the Diátaxis framework to organise your documents. I have all my documents listed under the folders - Tutorials, How-to, Reference, Explanation. Tags are used to cross connect across those folders with features, functions or intended audience.

Installation

To install the plugin, use the following command:

pip install mkdocs-pagelist-plugin

For Github Actions add the following line in the appropriate place in the ci.yml file:

- run: pip install mkdocs-pagelist-plugin  

Usage

To use the PageListPlugin, add it to your mkdocs.yml configuration file under the plugins section:

plugins:
  - search
  - pagelist

Note: If you have no plugins entry in your config file yet, you'll need to add it before adding PageListPlugin, as MkDocs enables only the search plugin by default.

Examples

  • List other pages sharing the same tags as the current page:

    {pagelist}
    
  • List 10 pages sharing the same tags as the current page:

    {pagelist 10}
    
  • Group pages by folder, sharing the same tags as the current page:

    {pagelist g}
    
  • List pages tagged with 'draft':

    {pagelist 5 draft}
    
  • Combine multiple tags ('draft' and 'leads'):

    {pagelist 10 draft leads}
    
  • Include pages with 'leads' tag but exclude those with 'draft' tag:

    {pagelist 10 -draft leads}
    
  • Group pages by folder, tagged with 'leads':

    {pagelist g leads}
    
  • Group pages by folder, tagged with 'leads' but not 'draft':

    {pagelist g leads -draft}
    
  • List pages tagged with 'leads' in the 'how-to' folder:

    {pagelist 10 leads | how-to}
    
  • Generate a report of all {pagelist} commands used across the site:

    {pagelist i}
    

HTML and CSS

The rendered code looks something like this:

<div class="pagelist">
	<h3 class="pagelistheading">{folder.capitalize()}</h3>
	<ul class="pagelistlist">
		<li><a href="../../{page.url}">{page.title}</a></li>
	</ul>
</div>

License

This project is licensed under the MIT License.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-pagelist-plugin-0.2.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

mkdocs_pagelist_plugin-0.2.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-pagelist-plugin-0.2.2.tar.gz.

File metadata

File hashes

Hashes for mkdocs-pagelist-plugin-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0ccbc18683823a13867cf820e3652afcd858418828e01c0e760b5ecaceefb169
MD5 84b25458f88a0ec3ea5e07616b31efd6
BLAKE2b-256 a482a27dc8d94fd5452f68e05eec257d30c5b473935e173423f27666d5aec9ce

See more details on using hashes here.

File details

Details for the file mkdocs_pagelist_plugin-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_pagelist_plugin-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2931e7c3a4d7c90e1fecdd8655094891a8407197550545e73553a39d0a16183
MD5 5ed4461eeb2e860b782f7f0702ed98cd
BLAKE2b-256 6e46b2ee91f9defa7bb8f547bfebc279ea917c8213a1e62256aa1417dd99eae6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page