Skip to main content

Django Meta OG

HTML Meta tags OpenGraph for Django. The project uses the project DjangoCMS Meta OG project.

Install

pip install django-meta-og

Add into settings.py:

from django.utils.translation import gettext_lazy as _

INSTALLED_APPS = [
    "django_meta_og",
    ...
]

TEMPLATES  = [
    {"OPTIONS": {
            "context_processors": [
                "django_meta_og.context_processors.meta",
                ...
            ]
        }
    }
]

Add into the templates:

{% load django_meta_og %}
{% django_meta_og_prefix as og_prefix %}
<head{% if og_prefix %} prefix="{{ og_prefix }}"{% endif %}>
    {% include "django_meta_og/header_meta.html" %}

The result can be:

<head prefix="og: https://ogp.me/ns#">
    <meta property="og:type" content="website" />
    <meta property="og:title" content="The Title" />
    <meta property="og:url" content="https%3A%2F%2Fexample.com%2F" />
    ...
</head>

Prefix for Meta tags in template

Some Meta tags may already be defined in the template. Their prefix is ​​included in the prefix list via the definition in settings:

# Example of tag definition already used in the templates.
META_OG_PREFIX_IN_TEMLATES = (
    ("og", "https://ogp.me/ns#"),
    ("article", "https://ogp.me/ns/article#"),
)

Dynamic content

Special values ​​can be replaced with some content. A list of these values ​​is provided in the form in the item administration.

# Dynamic content - Key replacement for specific content.
PAGE_META_OG_DYNAMIC_CONTENT = {
    "ogc:page_url": (
        "django_meta_og.dynamic_content.get_page_url",
        _("Set the page absolute URL (together with parameters)."),
    ),
}

Admininstration

You can enter any Meta values. These are entered in three levels - Namespace, Property and Content.

Namespace

Namespace list

Namespace form

Property

Property list

Property form

Content

Content list

Content form

License

BSD License

Metadata

Release files for django-meta-og 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-meta-og 2.0.1
File Size Uploaded Provenance Actions
django_meta_og-2.0.1.tar.gz 10.8 kB Without provenance Details for django_meta_og-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-meta-og 2.0.1
File Interpreter ABI Platform Actions
django_meta_og-2.0.1-py3-none-any.whl Python 3 none any Details for django_meta_og-2.0.1-py3-none-any.whl

Total release size: 26.2 kB

Release files / django_meta_og-2.0.1.tar.gz

Download URL django_meta_og-2.0.1.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
267f0e22a95364649a3c0fee05926963982c29b0b8dd15002b048be1b71ee545
BLAKE2b-256 checksum
How to use checksums
6f475fc5e79d2adf02531433829bb009021f9b21cf973aaef852e166349c959d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Release files / django_meta_og-2.0.1-py3-none-any.whl

Download URL django_meta_og-2.0.1-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df30b464a3bacfb561208c777c105744ed16b6121d985411a0be0ad0edb4c58a
BLAKE2b-256 checksum
How to use checksums
2667a3fd295f5a7e39ebc4a56b1b50e9eb66d6e60a6a0c5ad5f37a2b5bdfd300
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.3

Security for django-meta-og 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page