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 enhances your MkDocs site's SEO and user engagement by generating meta tags (description, image, keywords) and adding interactive features based on your Markdown content.

Features

  • Automatically generates meta description and image tags based on the first paragraph and the first image of a page, respectively.
  • Allows manual specification of meta keywords in the Markdown frontmatter.
  • Generates Open Graph (Facebook) and Twitter meta tags for better social media sharing.
  • Adds social share buttons for Twitter and LinkedIn at the end of each page.
  • Fetches git information (dates and authors) from your repository and appends it to the page footer.

Installation

To install the MkDocs Ultralytics Plugin from pip, run the following command:

PyPI version Downloads

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

Plugin Arguments

The plugin supports the following arguments:

  • verbose: Enable or disable verbose output (default: True)
  • enabled: Enable or disable the plugin (default: True)
  • default_image: Set a default image URL if no image is found in the content (default: None)
  • add_desc: Enable or disable the generation of meta description tags (default: True)
  • add_image: Enable or disable the generation of meta image tags (default: True)
  • add_keywords: Enable or disable the generation of meta keyword tags (default: True)
  • add_share_buttons: Enable or disable the addition of share buttons for Twitter and LinkedIn (default: True)
  • add_dates: Enable or disable the addition of git dates to the page footer (default: True)
  • add_authors: Enable or disable the addition of git authors to the page footer (default: True)

To use the arguments, add them to the ultralytics plugin section in your mkdocs.yml file:

plugins:
  - mkdocstrings
  - search
  - ultralytics:
      verbose: True
      enabled: True
      default_image: "https://example.com/default-image.png"
      add_desc: True
      add_image: True
      add_keywords: True
      add_share_buttons: True
      add_dates: True
      add_authors: True

How it works

The plugin works by processing your Markdown content, extracting relevant information, and generating additional meta tags and interactive features.

Meta Description

If add_desc is enabled, 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

If add_image is enabled, the meta image is extracted from the first image in your Markdown content. If no image is available, it uses the default_image (if specified). The image URL is added as <meta property="og:image"> and <meta property="twitter:image"> tags.

Meta Keywords

You can manually specify meta keywords in the Markdown frontmatter. These will be added as a <meta name="keywords"> tag in the page's <head> section.

Share Buttons

If add_share_buttons is enabled, share buttons for Twitter and LinkedIn are added to the page. These allow users to easily share your content on social media.

Git Dates and Authors

If add_dates or add_authors is enabled,

the plugin fetches relevant git information from your repository and appends it to the page footer. This keeps your readers informed about the recency and authorship of the content.

Plugin Code

The core functionality of the plugin is implemented in plugin.py, which defines the MetaPlugin class:

from mkdocs.plugins import BasePlugin


class MetaPlugin(BasePlugin):

    def on_page_content(self, content, page, config, files):
        # ... (code to generate meta description and image)
        return

    def on_post_page(self, output, page, config):
        # ... (code to update the output with the generated meta tags)
        return

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.34.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

mkdocs_ultralytics_plugin-0.0.34-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for mkdocs-ultralytics-plugin-0.0.34.tar.gz
Algorithm Hash digest
SHA256 5152932026cf0d8bb8e62833a8b58da38f588ee0f2450f647a3fb2fcbeafe030
MD5 ea5a0e9b00d3a6919b3983c00bc6401a
BLAKE2b-256 2516e61c571f3ee28260324c9f8ab9c86e0acd6714087bd41ef872cd166e3b3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_ultralytics_plugin-0.0.34-py3-none-any.whl
Algorithm Hash digest
SHA256 f5b2049b8f65c1bd56ab6fce3dfa5c6aa90f6153fca9d6f0265ba37fad88df26
MD5 a2d4f69d558a7a724dca01985e4633af
BLAKE2b-256 5e006f5ba16c6dc6eacd2da9ac98c15c76d85ad40df54356e105b272e45d8d6e

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