Skip to content

Conversation

@shahzan01
Copy link
Collaborator

Add Author Contact Fallback in Schema.org Plugin

Pull Request for Issue #<replace_with_issue_number>.


Summary of Changes

This PR enhances the Schema.org system plugin with an improved contact fallback chain and configuration options.

New behavior (contact resolution order):

  1. Manual fields – If a contact is explicitly set in the schema data for the role.
  2. Selected contact – If a modal_contact is chosen in the schema form.
  3. Author’s contact – If no contact is selected, the plugin now looks up the article’s created_by user and links to their preferred com_contact record.
    • If a user has multiple contact records, the plugin can be configured to map a specific user → contact in plugin parameters.
    • If no mapping exists, the first published contact for that user is used.
  4. Default contact – Finally, if none of the above is available, the plugin uses the default contact defined in the plugin params.

Testing Instructions

  1. Go to Extensions → Plugins → System – Schema.org and configure:
    • A Default Contact.
    • (Optional) Add a mapping between authors and their preferred contacts.
  2. Create or edit an article:
    • Case 1: Select a contact manually in the Schema tab → that contact appears in JSON-LD.
    • Case 2: Leave contact empty, ensure the author has a linked contact in com_contact → author’s contact appears in JSON-LD.
    • Case 3: Author has multiple contacts → the mapped contact in plugin params is used (or the first published contact if no mapping).
    • Case 4: No author contact → default contact appears.
  3. Inspect the page source and verify the application/ld+json block contains

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.

2 participants