An MkDocs plugin that provides Ultralytics Docs customizations at https://docs.ultralytics.com.
Project description
MkDocs Ultralytics Plugin
The MkDocs Ultralytics Plugin is an easy-to-use plugin that generates meta description and image tags based on the first paragraph and the first image in a page. It's specifically designed for MkDocs and provides a seamless integration to enhance your documentation.
Installation
To install the MkDocs Ultralytics Plugin from pip, run the following command:
pip install mkdocs-ultralytics-plugin
Usage
To enable the plugin in your MkDocs project, add it to the plugins
section of your mkdocs.yml
file:
plugins:
- mkdocstrings
- search
- ultralytics
How it works
The plugin works by extracting the first paragraph and the first image (if available) from your Markdown content. It then generates and adds the appropriate meta description and image tags to the page's <head>
section.
Meta Description
The meta description is extracted from the first paragraph of your Markdown content. The generated description is then added to the page's <head>
section as a <meta name="description">
tag.
Meta Image
The meta image is extracted from the first image (if available) in your Markdown content. The generated image URL is then added to the page's <head>
section as a <meta property="og:image">
tag.
Plugin Code
The core functionality of the plugin is implemented in plugin.py
, which defines the MetaPlugin
class:
from bs4 import BeautifulSoup
from mkdocs.plugins import BasePlugin
class MetaPlugin(BasePlugin):
def on_page_content(self, content, page, config, files):
# ... (code to generate meta description and image)
def on_post_page(self, output, page, config):
# ... (code to update the output with the generated meta tags)
License
This project is licensed under the AGPL-3.0 License. For more information, see the LICENSE file.
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
File details
Details for the file mkdocs-ultralytics-plugin-0.0.16.tar.gz
.
File metadata
- Download URL: mkdocs-ultralytics-plugin-0.0.16.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5c08b48b4534a3ca6ba66154288e5cec324a5548fb7269a6dc45087535f6d28 |
|
MD5 | 5f8250693f4dc8da3b5211daa3fb6a54 |
|
BLAKE2b-256 | fc4f1bc8bf5bba55849d22a13f542da0ce1ed119541d7746f3d624ed495fc4bc |
File details
Details for the file mkdocs_ultralytics_plugin-0.0.16-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_ultralytics_plugin-0.0.16-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9a02acae55ccdb569c7945c6a86809f94ee4a98987e741f5c75e1c70a9854da |
|
MD5 | d5cd6e0715a0746a27408f51dd2d58a4 |
|
BLAKE2b-256 | 70fc2240a5c0217c806d0afad83ef460547643d7687fbafc70e79f24369724bc |