Django HTML Meta tags for OpenGraph.
Project description
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
Property
Content
License
BSD License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_meta_og-1.1.1.tar.gz.
File metadata
- Download URL: django_meta_og-1.1.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d6c77a82d595c89e31e399551b724ca0e9e6865912aa014a5e3b0ddd23d8a22
|
|
| MD5 |
19a4af1bab758fd6b02db6145ba50fa2
|
|
| BLAKE2b-256 |
20f162ff068c7b1d7c26e0d70e399474d7e8ddab90ebd5255b7b887e3a4fd119
|
File details
Details for the file django_meta_og-1.1.1-py3-none-any.whl.
File metadata
- Download URL: django_meta_og-1.1.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4e38362acc08b66334ee4939a82ecbefeff5a589193c6ee9fc61daa336f1042
|
|
| MD5 |
625a0f17806e5c1af28fe6003e169698
|
|
| BLAKE2b-256 |
e0b989368a40fd8e29dc3aa653095383afdbe7435c4ad1e079123a7e0bacc390
|