Material Design theme for MkDocs with built-in plugins for blogs, search, social cards, and privacy compliance
—
Privacy compliance features including external asset localization, cookie consent management, and GDPR compliance helpers. The privacy plugin ensures documentation sites meet privacy regulations by controlling external resource loading and providing transparency about data usage.
Core privacy configuration that enables privacy-focused features and external resource management.
plugins:
- material/privacy:
enabled: true # Enable privacy plugin (default: true)
concurrency: 4 # Processing concurrency (default: CPU cores - 1)
cache: true # Enable caching (default: true)
cache_dir: .cache/plugin/privacy # Cache directory
assets: true # Process external assets (default: true)
assets_fetch: true # Fetch external assets (default: true)
assets_fetch_dir: assets/external # External assets directoryControl how external assets (fonts, images, scripts) are handled for privacy compliance.
plugins:
- material/privacy:
external_assets: bundle # Asset handling mode
external_assets_dir: assets/external # Local storage directory
external_assets_include: [] # Include patterns
external_assets_exclude: [] # Exclude patternsAsset Handling Modes:
report: Report external assets without modificationbundle: Download and serve external assets locallyexclude: Remove external assets entirelyFine-grained control over which external assets to process.
plugins:
- material/privacy:
external_assets_include:
- "*.googleapis.com/*" # Include Google Fonts
- "*.gstatic.com/*" # Include Google static assets
external_assets_exclude:
- "*.google-analytics.com/*" # Exclude analytics
- "*.googletagmanager.com/*" # Exclude tag managerManagement of external links and privacy-related link attributes.
plugins:
- material/privacy:
external_links: true # Process external links
external_links_attr_map:
target: _blank # Open in new tab
rel: noopener noreferrer # Privacy-focused rel attributes
external_links_noopener: true # Add noopener to external linksplugins:
- material/privacy:
external_assets: bundleplugins:
- material/privacy:
external_assets: bundle
external_assets_dir: assets/privacy
external_assets_exclude:
- "*.google-analytics.com/*"
- "*.googletagmanager.com/*"
- "*.facebook.com/*"
- "*.twitter.com/*"
external_links: true
external_links_attr_map:
target: _blank
rel: "noopener noreferrer"plugins:
- material/privacy:
external_assets: exclude
external_links: true
external_links_noopener: trueplugins:
- material/privacy:
external_assets: bundle
external_assets_include:
- "fonts.googleapis.com/*"
- "fonts.gstatic.com/*"
external_assets_exclude:
- "*.doubleclick.net/*"
- "*.googlesyndication.com/*"
- "*.amazon-adsystem.com/*"plugins:
- material/privacy:
external_assets: !ENV [PRIVACY_MODE, "report"]
external_assets_dir: !ENV [PRIVACY_DIR, "assets/external"]The privacy plugin works with cookie consent solutions to provide comprehensive privacy compliance.
<!-- In custom template or extra_javascript -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Cookie consent implementation
if (!localStorage.getItem('cookieConsent')) {
showCookieConsentBanner();
}
});
</script>---
title: Privacy Policy
---
# Privacy Policy
## External Resources
This site uses the following external resources:
- Google Fonts for typography
- Local copies of all JavaScript libraries
## Data Collection
We do not collect personal data through:
- Analytics tracking
- Social media widgets
- Third-party advertising
## Contact
For privacy concerns, contact: privacy@example.comThe plugin can generate reports of external asset usage for compliance auditing.
{
"external_assets": [
{
"url": "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap",
"type": "stylesheet",
"pages": ["index.html", "about.html"],
"status": "bundled"
}
],
"external_links": [
{
"url": "https://example.com",
"pages": ["index.html"],
"attributes": {"target": "_blank", "rel": "noopener noreferrer"}
}
]
}Integrate with site-wide privacy settings.
site_name: My Documentation
site_url: https://example.com
extra:
privacy:
policy_url: /privacy/
contact_email: privacy@example.com
plugins:
- material/privacy:
external_assets: bundle
external_links: true<!-- In custom templates -->
{% if config.extra.privacy %}
<div class="privacy-notice">
<p>This site respects your privacy.
<a href="{{ config.extra.privacy.policy_url }}">Privacy Policy</a>
</p>
</div>
{% endif %}class PrivacyPlugin(BasePlugin[PrivacyConfig]):
"""Privacy plugin for external asset management and compliance."""
def on_config(self, config):
"""Configure privacy plugin settings."""
@event_priority(-100)
def on_files(self, files, *, config):
"""Process files for privacy compliance."""
@event_priority(-100)
def on_page_content(self, html, *, page, config, files):
"""Process page content for privacy compliance."""
def on_env(self, env, *, config, files):
"""Configure template environment for privacy."""
@event_priority(-50)
def on_post_template(self, output_content, *, template_name, config):
"""Process template output for privacy compliance."""
@event_priority(-50)
def on_post_page(self, output, *, page, config):
"""Process page output for privacy compliance."""
@event_priority(50)
def on_post_build(self, *, config):
"""Generate privacy reports and finalize asset processing."""class PrivacyConfig(Config):
"""Configuration options for the privacy plugin."""
enabled = Type(bool, default=True)
external_assets = Choice(['report', 'bundle', 'exclude'], default='report')
external_assets_dir = Type(str, default='assets/external')
external_assets_include = Type(list, default=[])
external_assets_exclude = Type(list, default=[])
external_links = Type(bool, default=False)
external_links_attr_map = Type(dict, default={})
external_links_noopener = Type(bool, default=True)Use this checklist to ensure privacy compliance:
rel="noopener noreferrer" added to external linksInstall with Tessl CLI
npx tessl i tessl/pypi-mkdocs-material