MkDocs Publish Control
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
hiddenmetadata flag. - Override visibility settings using environment variables.
- Works with both
mkdocs serveandmkdocs 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: trueis set, the page will be excluded from the build - If
hidden: falseis 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:
- Using environment variable:
MKDOCS_SHOW_ALL=true mkdocs serve
- 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
- Create a markdown file with hidden metadata:
---
hidden: true
---
# Draft Content
This page will not appear in the build by default.
- 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)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocs_publish_control-0.1.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|