Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-ultralytics-plugin-0.0.15.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file mkdocs-ultralytics-plugin-0.0.15.tar.gz.

File metadata

File hashes

Hashes for mkdocs-ultralytics-plugin-0.0.15.tar.gz
Algorithm Hash digest
SHA256 92a6568a6f8121e7cf131f58d91876928640a75e1e7df87b105a8b39ceb519c1
MD5 fa7536b9fe1c46a21236b2b0db9e2a4c
BLAKE2b-256 c914dc606f4abf81de994ad92c2e58fa2277d9ad1430832ae356da4fe0bb2fec

See more details on using hashes here.

File details

Details for the file mkdocs_ultralytics_plugin-0.0.15-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_ultralytics_plugin-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 eb38cfb4fffdf063e956224a811233b1f21143be1ab60a42db19843b4e26d7d6
MD5 85b7907784a36f67bf57077929743d39
BLAKE2b-256 c080d18c0f002ffe0be9b55855101000bbb1617f400c0f651fdaf697bb268b35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page