Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added metadata to events page #1119

Merged
merged 5 commits into from
Sep 20, 2024
Merged

Added metadata to events page #1119

merged 5 commits into from
Sep 20, 2024

Conversation

ResendeTech
Copy link
Contributor

@ResendeTech ResendeTech commented Sep 20, 2024

User description

issue #489 began the progress in doing it.


PR Type

enhancement, documentation


Description

  • Added JSON-LD structured data to the event page to improve SEO by providing search engines with detailed event metadata.
  • Metadata includes event name, start and end dates, status, attendance mode, description, URL, category, and website.
  • Ensured that the event category and website URL are dynamically included in the structured data.

Changes walkthrough 📝

Relevant files
Enhancement
event.html
Add JSON-LD structured data for SEO enhancement                   

events/templates/events/event.html

  • Added structured data using JSON-LD for SEO.
  • Included metadata for event details like name, startDate, endDate, and
    description.
  • Ensured dynamic event category and website URL are included in
    metadata.
  • +64/-49 

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Possible Bug
    The URL in the 'Events' link may have a typo. 'caegory' is used instead of 'category'.

    Code Smell
    The JSON-LD script contains an HTML comment which may cause issues when parsed as JSON.

    Copy link

    codiumai-pr-agent-pro bot commented Sep 20, 2024

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Correct the category parameter in the parent page URL

    Fix the typo in the category parameter of the parent page URL.

    events/templates/events/event.html [30]

    -<a href="{% pageurl page.get_parent %}?category={{ page.category }}">
    +<a href="{% pageurl page.get_parent %}?category={{ event.category }}">
     
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Fixing the typo in the category parameter is crucial for ensuring the correct functionality of the URL, which directly impacts navigation and user experience.

    9
    Enhancement
    Add dynamic event attendance mode and location information to structured data

    Add a fallback for the event location, such as "Online" or "To be announced", when
    the location is not specified.

    events/templates/events/event.html [21]

    -"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
    +"eventAttendanceMode": "{% if event.location %}https://schema.org/OfflineEventAttendanceMode{% else %}https://schema.org/OnlineEventAttendanceMode{% endif %}",
    +"location": "{% if event.location %}{{ event.location|escapejs }}{% else %}To be announced{% endif %}",
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Adding a fallback for the event location and dynamically setting the attendance mode enhances the structured data's accuracy and completeness, improving SEO and user experience.

    8
    Preserve HTML formatting in the event description for structured data

    Consider using the safe filter for the event.body in the JSON-LD script to preserve
    any HTML formatting while still escaping JSON special characters.

    events/templates/events/event.html [22]

    -"description": "{{ event.body|striptags|escapejs }}",
    +"description": "{{ event.body|safe|escapejs }}",
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Using the safe filter allows HTML formatting to be preserved in the event description, which can be beneficial for structured data presentation. However, it should be used cautiously to avoid potential security risks.

    7
    Consistency
    Ensure consistent use of the event website property

    Use event.website instead of event.specific.website for consistency with the
    condition check.

    events/templates/events/event.html [69]

    -<a href="{{ event.specific.website }}" class="btn btn-primary btn-sm" target="blank">
    +<a href="{{ event.website }}" class="btn btn-primary btn-sm" target="_blank">
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Using event.website consistently aligns with the condition check and avoids potential confusion or errors, improving code maintainability and readability.

    8

    💡 Need additional feedback ? start a PR chat

    @brylie brylie merged commit 240b9fb into main Sep 20, 2024
    5 checks passed
    @brylie brylie deleted the SEO-markups branch September 20, 2024 14:42
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants