Simple-Calendar icon indicating copy to clipboard operation
Simple-Calendar copied to clipboard

Issue schema search console

Open Akhill2020 opened this issue 2 months ago • 1 comments

Summary by CodeRabbit

  • New Features

    • Events include a visible schema metadata tag and automatically emit missing hidden schema.org properties (endDate, attendance mode, status, URL, offers, image, performer, organizer, description).
    • Main event links now include proper schema URL semantics.
    • Default calendar/event templates now include the schema metadata tag.
  • Bug Fixes

    • Templates missing the schema metadata tag can be detected and updated to ensure consistent structured-data output.

Akhill2020 avatar Oct 29 '25 08:10 Akhill2020

Walkthrough

Adds a public schema-meta content tag, emits missing schema.org properties for events, updates link generation to mark main event URLs with itemprop="url", replaces Place/Person itemtype URLs with https, and adds helpers and a calendar-template updater to insert [schema-meta] where missing.

Changes

Cohort / File(s) Summary
Event builder & schema helpers
includes/events/event-builder.php
Adds schema-meta to public content tags and handles it in process_event_content. parse_event_template_tags() now runs shortcodes first and will append generated schema metadata when schema-meta is absent. Adds private helpers: get_missing_schema_properties(Event $event), get_event_image_url(Event $event), get_event_performer(Event $event). Updates make_link() signature to ($tag, $url, $content, $attr, $is_event_url = false) and propagates $is_event_url so main event links include itemprop="url". Replaces Place/Person itemtype URLs with https://schema.org/....
Calendar template utilities
includes/functions/shared.php
Updates simcal_default_event_template() to include [schema-meta]. Adds simcal_update_calendar_templates_for_schema() which scans calendar posts and appends [schema-meta] to templates missing it, updates posts via wp_update_post, clears related transients, and returns the count updated.

Sequence Diagram(s)

sequenceDiagram
    participant Template as Event Template
    participant Builder as Event_Builder
    participant Helpers as Schema Helpers
    participant DB as Calendar DB

    Template->>Builder: parse_event_template_tags(template, event)
    Builder->>Builder: run shortcodes first
    alt template contains [schema-meta]
        Builder->>Helpers: process_event_content(tag="schema-meta", event)
        Helpers-->>Builder: hidden schema.org properties markup
        Builder->>Template: inject markup at tag location
    else template lacks [schema-meta]
        Builder->>Helpers: get_missing_schema_properties(event)
        Helpers-->>Builder: generated hidden schema.org properties
        Builder->>Template: append generated markup to end
    end

    Note right of DB: maintenance function
    DB->>DB: simcal_update_calendar_templates_for_schema()\n(scan calendars, append `[schema-meta]` where missing)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Verify correctness and completeness of properties produced by get_missing_schema_properties(), especially required fields like endDate, offers, and eventStatus.
  • Review fallbacks in get_event_image_url() (custom logo, site icon) and get_event_performer() (organizer/site name) for edge cases.
  • Confirm all call sites updated for the make_link() signature change and that itemprop="url" is applied only to primary event URLs.
  • Validate simcal_update_calendar_templates_for_schema() handles permissions, WP_Error, and transient clearing safely.

Poem

🐰
I hopped through tags at evening’s gleam,
Hid meta crumbs in every theme,
Dates and images tucked in neat,
Organizers and links complete,
A rabbit’s schema, soft and keen.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Issue schema search console' is vague and does not clearly convey the actual changes made. The PR implements schema.org metadata handling and enrichment for events, but the title only hints at addressing an 'issue' related to 'schema search console' without specificity. Consider using a more descriptive title such as 'Add schema.org metadata enrichment for events' or 'Implement missing schema properties for event structured data' to better reflect the primary changes in the PR.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch issue-schema-search-console

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Oct 29 '25 08:10 coderabbitai[bot]