Skip to content

Object_type property seems to have no effect on og:type because of the defaults #186

@myriadhero

Description

@myriadhero

Description

The doc says:

object_type

This key is used to render the og:type property.

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

  1. Set object_type: 'website' in _metadata; or even in settings.py of the django site set META_SITE_TYPE = "website"
  2. 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:

        {% if meta.og_type %}{% og_prop 'type' meta.og_type %}
        {% elif meta.object_type %}{% og_prop 'type' meta.object_type %}{% endif %}

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions