Skip to main content

MkDocs Exclude Unused (orphaned) Files

A simple plugin for excluding files from being included in the mkdocs output if they are not referenced on other pages.

Installation

pypi current version

Run pip install --upgrade mkdocs-exclude-unused-files

Configuration

Basic Configuration in the mkdocs.yml file:

plugins:
  - exclude-unused-files:
      file_types_to_check: ["png", "jpg", "jpeg", "gif"]
      enabled: !ENV [CI, false]

This configuration will exclude all files from the final mkdocs output that has one of the configured file endings and are not referenced/linked to other pages.

Default types

The plugin uses a default set of file types:

png, jpg, jpeg, gif, pdf, ico, drawio, tif, tiff, zip, tar.gz, rar, ogg, mp3, mp4, vtt , ogv, mov, svg, pot, potx, ppsx, ppt, pptx, xlt, xltx, xls, xlsx, doc, docx, dot, dotx, vst, vstx, vsd, vsdx

All Configuration Options

Setting Default Description
enabled True Whether the plugin is enabled when building your project. If you want to switch the plugin off, e.g. for local builds, use an environment variables.
enabled_on_serve False Whether the plugin is enabled when serving your project. It does not apply if enabled is False. It's just to explicitly enable the plugin during mkdocs serve.
dry_run False Only print output into the command line and don't actually delete anything
silent False Don't print out the found orphan files in the build process
force_delete False By default the plugin only deletes files that are actually in the configured mkdocs output directory (site_dir). If you want to delete these files anyways due to your setup, enable this flag
file_types_to_check [] Only check these file types for their usage and delete them if necessary.
file_types_override_mode replace Behavior of file_types_to_check towards default types: replace - uses only defined types, append - adds additional types to default list, remove - removes specified types from default.
file_names_to_never_remove ["favicon"] Files with these names will never get deleted, even if no usage is detected.
folders_to_never_remove_from ["assets"] Files in these folders will never get deleted, even if no usage is detected. Useful for always including specific static files.
file_name_suffixes_to_trim ["#only-light", "#only-dark"] Trim-away suffixes in this list when checking if a file-name is used. This is used for ignoring material-mkdoc's color-palette-toggle instructions (see Issue-4).

Metadata

Release files for mkdocs-exclude-unused-files 1.4.1

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-exclude-unused-files 1.4.1
File Size Uploaded Provenance Actions
mkdocs_exclude_unused_files-1.4.1.tar.gz 5.5 kB Without provenance Details for mkdocs_exclude_unused_files-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-exclude-unused-files 1.4.1
File Interpreter ABI Platform Actions
mkdocs_exclude_unused_files-1.4.1-py3-none-any.whl Python 3 none any Details for mkdocs_exclude_unused_files-1.4.1-py3-none-any.whl

Total release size: 11.8 kB

Release files / mkdocs_exclude_unused_files-1.4.1.tar.gz

Download URL mkdocs_exclude_unused_files-1.4.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
96864e19a518afbb7f6e8bf4cf724f880da483e108d1dc00b58ca04a7214282d
BLAKE2b-256 checksum
How to use checksums
cdb348d7fc03b8d9f5d84507f56a30e9f9930dee87433456db6c394baa757a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure

Release files / mkdocs_exclude_unused_files-1.4.1-py3-none-any.whl

Download URL mkdocs_exclude_unused_files-1.4.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da702f03d19e696fedb7f42505cf52a858e4c917478ad2475fee4f01350bda16
BLAKE2b-256 checksum
How to use checksums
39dec8423890b484d6e2203240389bf1ba2af9d18272470cf2c357506d1190b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure

Security for mkdocs-exclude-unused-files 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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