You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
however, when adding it to the model _metadata, I could only get og:type Article. .as_meta() method outputted object_type of my choosing but og_type is always set as Article.
-> Setting og_type instead of object_type fixes the issue, but it doesn't seem to be what the docs recommend?
Steps to reproduce
Set object_type: 'website' in _metadata; or even in settings.py of the django site set META_SITE_TYPE = "website"
Observe the object_type gets assigned correctly but the template renders og:type as Article
Versions
Python 3.11, Django 4.2.7, django-meta 2.4.0
Expected behaviour
Docs seem to imply that setting object_type or META_SITE_TYPE will have effect on og:type.
Actual behaviour
Object type seems to have no effect on og:type because of the defaults
Additional information
The template (meta/meta.html) checks for og_type first:
og_type gets filled with defaults, so it'll never fail over. It also doesn't get filled with META_SITE_TYPE or object_type during meta building as far as i understand.
The text was updated successfully, but these errors were encountered:
frommeta.modelsimportModelMetaclassSiteIdentity(ModelMeta, models.Model):
title=models.CharField(max_length=100)
seo_description=models.TextField(
blank=True, help_text="Used in SEO meta tags, should be 50-160 characters long"
)
seo_keywords=models.CharField(
max_length=250,
blank=True,
help_text="List of words in SEO meta tags, eg 'blog, django, python' without quotes, comma separated",
)
logo_title=models.ImageField(
upload_to="site_identity/", blank=True, help_text="Used for the main top logo"
)
logo_square=models.ImageField(
upload_to="site_identity/",
blank=True,
help_text="Used for seo and other places where a square logo is needed",
)
favicon=models.ImageField(upload_to="site_identity/", blank=True)
_metadata= {
"title": "title",
"description": "seo_description",
"keywords": "get_seo_keywords",
"image": "get_logo_square_url",
# "og_type": "Website", # adding this fixes the issue"object_type": "Website",
}
defget_logo_square_url(self):
returnself.logo_square.urlifself.logo_squareelseNonedefget_seo_keywords(self):
return (
[
stripped_wordforwordinself.seo_keywords.split(",")
if (stripped_word:=word.strip())
]
ifself.seo_keywordselseNone
)
I would offer to help fix this, but I'm not super confident and I'd need guidance as I'm a beginner and I'm not sure whether the issue is with docs or my understanding or the code. 🤔😅
Description
The doc says:
however, when adding it to the model
_metadata
, I could only get og:type Article..as_meta()
method outputted object_type of my choosing but og_type is always set as Article.-> Setting og_type instead of object_type fixes the issue, but it doesn't seem to be what the docs recommend?
Steps to reproduce
object_type: 'website'
in_metadata
; or even in settings.py of the django site setMETA_SITE_TYPE = "website"
object_type
gets assigned correctly but the template renders og:type as ArticleVersions
Python 3.11, Django 4.2.7, django-meta 2.4.0
Expected behaviour
Docs seem to imply that setting object_type or META_SITE_TYPE will have effect on og:type.
Actual behaviour
Object type seems to have no effect on og:type because of the defaults
Additional information
The template (
meta/meta.html
) checks forog_type
first:og_type
gets filled with defaults, so it'll never fail over. It also doesn't get filled withMETA_SITE_TYPE
orobject_type
during meta building as far as i understand.The text was updated successfully, but these errors were encountered: