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.1.0

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.1.0
File Size Uploaded Provenance Actions
django_meta_og-2.1.0.tar.gz 11.0 kB Without provenance Details for django_meta_og-2.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 26.5 kB

Release files / django_meta_og-2.1.0.tar.gz

Download URL django_meta_og-2.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a9129e244d35d089ba674bb612e369c0f1707c6566eb8b25dd74165a2314564b
BLAKE2b-256 checksum
How to use checksums
702fa6ae9f75f0697a29aa8ef528f3c3a5d6e568f337fb4283419bf9d48b5abc
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.1.0-py3-none-any.whl

Download URL django_meta_og-2.1.0-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68a06f44210a176efead5f8e48932016804594a10dd9dfb4a3b9b11717c2385d
BLAKE2b-256 checksum
How to use checksums
a2b9127e30310aebbc8d4e817e246a1e89480c7cef0c9651520d9c42c3e12790
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.1.0

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