Skip to content

fix: prevent duplicate og:type when set via extra_custom_props#275

Open
danishashko wants to merge 2 commits into
nephila:developfrom
danishashko:fix/duplicate-og-type
Open

fix: prevent duplicate og:type when set via extra_custom_props#275
danishashko wants to merge 2 commits into
nephila:developfrom
danishashko:fix/duplicate-og-type

Conversation

@danishashko

Copy link
Copy Markdown

Fixes #264

When extra_custom_props already contains an og:type property, the template was still rendering the og_type/object_type field separately, which produced a duplicate <meta property="og:type"> tag. This breaks Open Graph validators that expect exactly one og:type.

Changes:

  • Added has_og_type_in_custom_props() method to Meta class in views.py that checks whether og:type is already defined in extra_custom_props
  • Updated meta.html template to skip the standard og:type output when that method returns True, letting the custom props version take precedence

The existing behavior is unchanged for anyone who doesn't set og:type via extra_custom_props.

@protoroto

Copy link
Copy Markdown
Member

@danishashko Hi! Thanks for opening this: are you up to write some test for this? Ther's something already written in the issue you linked.
Also, in order for the tests in CI to pass, would you mind:

  • renaming your branch to something like bugfix/issue-264-duplicate-og-type
  • creating a changes/264.bugfix file with a brief explaination of the fix you made? Something like Prevent duplicate og:type if already defined in extra_custom_props should be fine
    Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Duplicate og:type when using extra_custom_props

2 participants