Django template tag for json-ld
Project description
django-json-ld
This is a django template tag to help developers render structured data tags inside their django templates.
Installation
Install using pip
:
pip install django-json-ld
Add django_json_ld
to INSTALLED_APPS
in settings.py
:
INSTALLED_APPS = [
# Other apps...
'django_json_ld',
]
Usage Example
Assuming you have a structured data sd
like the following in your context (copied from the link above).
sd = {
"@context": "https://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"name": "Unlimited Ball Bearings Corp.",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-401-555-1212",
"contactType": "Customer service"
}
}
Then, in your template:
{% load render_json_ld from django_json_ld %}
{% render_json_ld sd %}
Would render into:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"name": "Unlimited Ball Bearings Corp.",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-401-555-1212",
"contactType": "Customer service"
}
}
</script>
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
django-json-ld-0.0.1.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for django_json_ld-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d5e93ea09d7b9c30956bac8aa14a9d67c713345a8ed4c99210b819bb996a49d |
|
MD5 | bb54072eaba49c379de3e2d0b6747498 |
|
BLAKE2b-256 | d267bc2ace16a58f954d354b7487e524f87a57602d5798a00dd0b9aaa758e9bb |