Skip to content

New Feature: add structured data - #20

Merged
1letter merged 14 commits into
masterfrom
json-ld-adpater
Oct 8, 2026
Merged

1letter merged 14 commits into
masterfrom
json-ld-adpater

Conversation

@1letter

@1letter 1letter commented Oct 7, 2026

Copy link
Copy Markdown
Contributor
  • register a new viewlet
  • extend the behavior with new field to provide structured data
  • implement an adapter resolution to provide structured data in an alternative way (similar to CSS body classes in plone.app.layout)

@1letter
1letter requested a review from fredvd October 7, 2026 06:40
@erral
erral self-requested a review October 7, 2026 12:25

@petschki petschki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a quick look at this. See my comments.

Comment thread src/collective/behavior/seo/browser/structured_data.py Outdated
Comment thread src/collective/behavior/seo/browser/structured_data.py Outdated
Comment thread src/collective/behavior/seo/browser/structured_data.py Outdated
Comment thread src/collective/behavior/seo/browser/structured_data.pt
Comment thread src/collective/behavior/seo/browser/structured_data.py Outdated
@1letter
1letter requested a review from petschki October 7, 2026 18:28

@petschki petschki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM!

My comments are more cosmetic ...


try:
extra_data = seo_adapter.get_data() or []
except (TypeError, KeyError, AttributeError):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put a log here, to show which adapter has problems. Also what about ValueError ? Maybe catch all exceptions?

class StructuredDataViewlet(ViewletBase):
"""Base viewlet to render content metadata as JSON-LD"""

""" the use of this decorator is this a right approach?"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can be removed.

@erral

erral commented Oct 8, 2026

Copy link
Copy Markdown
Member

@petschki was indeed faster than me checking this, but I really like the adapter way to append data to the structured data record, I wonder we could do the same for social tags (right now we have to inherit the viewlet and override a method)

Big +1

@1letter
1letter merged commit 650886a into master Oct 8, 2026
7 checks passed
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.

3 participants