-
Notifications
You must be signed in to change notification settings - Fork 0
Add structured data using JSON-LD for TV series in search results #1250
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
Conversation
Summary of ChangesHello @Ziedelth, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates JSON-LD structured data into the search results template, specifically for TV series. The primary goal is to enhance the discoverability and presentation of TV series content on search engines by providing detailed, schema-compliant metadata. This change leverages existing data structures to automatically populate the structured data, ensuring consistency and reducing manual effort. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds structured data (JSON-LD) for TV series on the search results page. The implementation correctly adds a script tag with application/ld+json for each search result. However, the logic to generate the JSON-LD object is implemented in client-side JavaScript, which duplicates existing server-side logic found in src/main/resources/templates/site/seo/json-ld.ftl. This creates a maintainability concern, as any changes to the JSON-LD structure would need to be made in two different places. My review includes a suggestion to refactor this by centralizing the JSON-LD generation logic in the backend to ensure a single source of truth.
40afde4 to
f3e4d1e
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the JSON-LD generation by moving the logic from Freemarker templates to a dedicated Kotlin JsonLdBuilder service. This is a great improvement for maintainability and separation of concerns. The implementation is well-done, using data classes to model the schema and Gson for serialization. I've found one issue where the list of platforms in the generated JSON-LD is not filtered correctly, leading to a discrepancy with the UI. A fix is suggested in the detailed comment. Otherwise, the changes look good.
| ) | ||
| seasons = seasons, | ||
| platformIds = platforms.filter { showAllPlatforms || it.platform.isStreaming }.toTreeSet(), | ||
| ).also { dto -> dto.jsonLd = jsonLdBuilder.build(dto, seasons, platforms) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bug here. The JsonLdBuilder.build method is called with the original, unfiltered platforms set. However, the AnimeDto's platformIds property is assigned a filtered set of platforms on the previous line. This causes a discrepancy where the generated JSON-LD for search engines includes all platforms (even non-streaming ones when they should be hidden), while the UI shows a filtered list. The JSON-LD should be consistent with the displayed data.
You can fix this by passing the filtered platformIds from the DTO to the builder, which is available within the also block.
| ).also { dto -> dto.jsonLd = jsonLdBuilder.build(dto, seasons, platforms) } | |
| ).also { dto -> dto.jsonLd = jsonLdBuilder.build(dto, seasons, dto.platformIds ?: emptySet()) } |
f3e4d1e to
a430859
Compare
No description provided.