MkDocs plugin for the Beacon search widget
Project description
beacon-mkdocs-plugin
MkDocs plugin that embeds the Beacon search widget into your documentation site.
Status
Pre-alpha. Not yet published to PyPI.
Install
Once released:
pip install mkdocs-beacon-search
Quick start
Add the plugin to your mkdocs.yml and point it at a Beacon API:
plugins:
- beacon-search:
api_url: https://search-api.example.com
product: k0s
Run mkdocs build (or mkdocs serve locally). The plugin copies the widget bundle into the built site and mounts <beacon-search> into your theme automatically.
Configuration reference
| Option | Type | Default | Description |
|---|---|---|---|
api_url |
URL | — (required) | Base URL of the Beacon search API. |
product |
string | (unset) | Scope search to a single product. Maps to the widget's product attribute. |
embed_id |
string | (unset) | Publisher-supplied identifier for analytics segmentation (e.g. footer-v1.31). |
analytics |
on | off |
on |
Widget analytics posture. off fully opts the widget out (no script load, no events). |
analytics_consent_required |
bool | false |
When true, the widget defers analytics events until the host CMP dispatches beacon-analytics-consent-granted on document. |
replace_search |
bool | true |
On Material for MkDocs, replace the theme's built-in .md-search block with the widget. Set to false to keep both. |
placement |
CSS selector | (theme default) | Override where the widget is mounted. When set, the plugin appends <beacon-search> inside the first matching element on every page. |
enabled |
bool | true |
Plugin master switch. Supports MkDocs' !ENV syntax for environment-gated builds. |
Unknown keys are rejected. Missing api_url fails the build.
Theme compatibility
| Theme | Default placement | Notes |
|---|---|---|
material (Material for MkDocs) |
Replaces .md-search when replace_search: true; otherwise appends to .md-header__inner. |
Primary target. Tested against Material 9.x. |
mkdocs (MkDocs built-in) |
Appends to .navbar. |
Works out of the box. |
readthedocs (MkDocs built-in RTD theme) |
Appends to .wy-side-nav-search (or .wy-nav-top if absent). |
Best-effort. |
| Anything else | No auto-placement. | Set placement: to a CSS selector, or use the Jinja macro. |
Manual placement (Jinja macro)
For full control, the plugin registers a {{ beacon_search() }} Jinja function. Use it inside a theme template override:
{# overrides/main.html #}
{% extends "base.html" %}
{% block content %}
{{ beacon_search() }}
{{ super() }}
{% endblock %}
# mkdocs.yml
theme:
name: mkdocs
custom_dir: overrides
When a page already contains a <beacon-search> element (from the macro or from markdown), auto-placement skips that page — no double-mount.
Content Security Policy
The widget is a pure <script> + custom element. If your site enforces CSP and you want widget analytics enabled:
script-srcmust allowhttps://www.googletagmanager.comconnect-srcmust allowhttps://www.google-analytics.comandhttps://*.analytics.google.com
If you set analytics: off, no third-party domains are contacted.
Migration from the <script> + custom element integration
If your site currently embeds the widget directly:
<script src="https://.../beacon-search.umd.js"></script>
<beacon-search api-url="..." product="k0s"></beacon-search>
Remove those two lines and add the plugin to mkdocs.yml. The plugin takes over script loading and element placement.
Development
See CONTRIBUTING.md.
License
Apache-2.0 — see LICENSE.
Contributing
Pull requests are welcome. See CONTRIBUTING.md for development setup.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs_beacon_search-0.1.2.tar.gz.
File metadata
- Download URL: mkdocs_beacon_search-0.1.2.tar.gz
- Upload date:
- Size: 170.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbf632ab2da4390932c9ad48679d35e3d5700f8cb87b0b60b58a9c98f07f06a8
|
|
| MD5 |
2b80be0420746eedb7e07efa7d247649
|
|
| BLAKE2b-256 |
71d6981f121f27f3cdcc6185f1b2c9e31c13ee8156454e0a02a68c453ce9aa00
|
Provenance
The following attestation bundles were made for mkdocs_beacon_search-0.1.2.tar.gz:
Publisher:
release.yml on Mirantis/beacon-mkdocs-plugin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_beacon_search-0.1.2.tar.gz -
Subject digest:
bbf632ab2da4390932c9ad48679d35e3d5700f8cb87b0b60b58a9c98f07f06a8 - Sigstore transparency entry: 1396528666
- Sigstore integration time:
-
Permalink:
Mirantis/beacon-mkdocs-plugin@b1267567b2ff1b2c5a26ebc84c4859ec1149a3b3 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Mirantis
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b1267567b2ff1b2c5a26ebc84c4859ec1149a3b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mkdocs_beacon_search-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mkdocs_beacon_search-0.1.2-py3-none-any.whl
- Upload date:
- Size: 84.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf3f7032bf2c4865fe085c53fc6aae989c782d73c9a88c9d0a14c1a8a93aec4
|
|
| MD5 |
e0f9ba2ac01527579c782203d4f5a92a
|
|
| BLAKE2b-256 |
a1ae1ba4f30c5845ea40121bb349446306ea305f327ec5f71859efbf8769a752
|
Provenance
The following attestation bundles were made for mkdocs_beacon_search-0.1.2-py3-none-any.whl:
Publisher:
release.yml on Mirantis/beacon-mkdocs-plugin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_beacon_search-0.1.2-py3-none-any.whl -
Subject digest:
eaf3f7032bf2c4865fe085c53fc6aae989c782d73c9a88c9d0a14c1a8a93aec4 - Sigstore transparency entry: 1396528683
- Sigstore integration time:
-
Permalink:
Mirantis/beacon-mkdocs-plugin@b1267567b2ff1b2c5a26ebc84c4859ec1149a3b3 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Mirantis
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b1267567b2ff1b2c5a26ebc84c4859ec1149a3b3 -
Trigger Event:
push
-
Statement type: