Skip to main content

MkDocs Publish Control

PyPI version Test Coverage License

A MkDocs plugin that allows you to control page visibility based on metadata. Perfect for managing draft content or private documentation within your MkDocs site.

Features

  • Control page visibility using simple metadata.
  • Show/hide pages based on hidden metadata flag.
  • Override visibility settings using environment variables.
  • Works with both mkdocs serve and mkdocs build.
  • Detailed logging for debugging.

Installation

Using Poetry

poetry add mkdocs-publish-control

Using pip

pip install mkdocs-publish-control

Usage

Basic Configuration

Add the plugin to your mkdocs.yml:

plugins:
  - publish-control:
      show_all: false  # default behavior

Controlling Page Visibility

In your markdown files, add the hidden metadata at the top of the file:

---
hidden: true
---

# Your page content
  • If hidden: true is set, the page will be excluded from the build
  • If hidden: false is set or the metadata is not present, the page will be included
  • The default behavior is to show pages (hidden: false)

Showing All Pages

You can override the visibility settings in two ways:

  1. Using environment variable:
MKDOCS_SHOW_ALL=true mkdocs serve
  1. Using configuration in mkdocs.yml:
plugins:
  - publish-control:
      show_all: true

Configuration Options

Option Type Default Description
enabled boolean true Enable or disable the plugin
show_all boolean false Show all pages regardless of their hidden status

Examples

Basic Usage

  1. Create a markdown file with hidden metadata:
---
hidden: true
---

# Draft Content
This page will not appear in the build by default.
  1. Run mkdocs:
mkdocs serve

The page will be excluded from the build.

Showing All Pages

To temporarily show all pages (including hidden ones):

MKDOCS_SHOW_ALL=true mkdocs serve

Or configure it permanently in mkdocs.yml:

plugins:
  - publish-control:
      show_all: true

Logging

The plugin provides detailed logging about which pages are being excluded. To see the logs, run mkdocs with the --verbose flag:

mkdocs serve --verbose

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for mkdocs-publish-control 0.1.2

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-publish-control 0.1.2
File Size Uploaded
mkdocs_publish_control-0.1.2.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-publish-control 0.1.2
File Interpreter ABI Platform
mkdocs_publish_control-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / mkdocs_publish_control-0.1.2.tar.gz

Download URL mkdocs_publish_control-0.1.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
12bd638b4b9f6e3e6ec036a3950c87bf393aa5bff4fafab507ab2d81bc90c35a
BLAKE2b-256 checksum
How to use checksums
f0079485571923c51743abb9093fe73acc7108a6f89b44c347e7d3ac1ee4fd8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.12 Linux/6.12.10-76061203-generic

Release files / mkdocs_publish_control-0.1.2-py3-none-any.whl

Download URL mkdocs_publish_control-0.1.2-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50fb23e5e9b061db96faf4f6df1037be35eec69109dd22926868be095ab7f4ca
BLAKE2b-256 checksum
How to use checksums
de850b407bbf02d1aca6349d295a8b472f3da423842b58d49cc28ef0da662182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.10.12 Linux/6.12.10-76061203-generic

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.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