hiimdoublej / django-json-ld Goto Github PK
View Code? Open in Web Editor NEWa template tag to help render json-ld structured data.
License: MIT License
a template tag to help render json-ld structured data.
License: MIT License
Currently this library is not Python 3.10 compatible. This is due to the existing import on utils.py:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
I'll submit a PR soon fixing this.
I already install and add this package in install app Please suggest to use this django_json_ld I am facing error django_json_ld' is not a registered tag library.
Hello again @hiimdoublej,
Currently when, for example, I use {% render_json_ld sd %}
in base.html
and sd
is empty or non-existant, django will render:
<script type="application/ld+json">""</script>
Lets call that option A.
I'm wondering if that's the best default behaviour or if we should do something else. Two alternative ideas come to mind:
B. Output nothing, so no script tags are printed.
C. Output a schema.org Thing
with the current page URL, something like:
<script type="application/ld+json">
{
"@context":"https://schema.org"
"@type":"Thing",
"url":"http://example.org/",
}
</script>
We can also make this behaviour user configurable.
What are your thoughts?
How I can get this:
"mainEntity": {
"@type": "Book",
"author": {
"@type": "Person",
"familyName": "van der Westhuizon",
"givenName": "Jason",
"name": "Jason van der Westhuizon"
},
"author": {
"@type": "Person",
"familyName": "du Toit",
"givenName": "Jene",
"name": "Jene du Toit"
},
"author": {
"@type": "Person",
"familyName": "September",
"givenName": "Koos",
"name": "Koos September"
},
"bookFormat": "http://schema.org/Paperback",
"datePublished": "2014-11",
"inLanguage": "en",
"isbn": "1234567890123",
"name": "My Book Name",
"numberOfPages": "381",
"publisher": {
"@type": "Organization",
"name": "My Publisher"
},
(multiple authors)?
Hey @hiimdoublej! I think last PR didn't went through the regular GH Actions process so the package didn't got updated on PyPI. You can check it here.
Can you please manually do the release? Thanks!
If you try to use this library on a project with Django>=4.0, and InvalidTemplateLibrary
get raised because of this deprecation.
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'django_json_ld.templatetags.json_ld': cannot import name 'force_text' from 'django.utils.encoding'
From Django 3.0, the above deprecation warning was added:
The smart_text() and force_text() aliases (since Django 2.0) of smart_str() and force_str() are deprecated. Ignore this deprecation if your code supports Python 2 as the behavior of smart_str() and force_str() is different there.
Now Python 2 ended its life cycle and those were just aliases from Django 2.0, it's safe to change that import.
I'll submit another PR soon.
Hi,
I need queryset from get_queryset to construct the structured data.
The current implementation calls first get_structured_data() then get_queryset(). Is there a way to change this behavior.
One option would be to include get_structured_data's logic in get_queryset().
Kind regards,
H.KIZIL
Following the readme:
https://github.com/hiimdoublej/django-json-ld#class-based-view-example
There is a line:
structured_data["event"] = get_next_event()
Should I import get_next_event from some library? Could not find anything in google
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.