feat: Add JSON-LD schema generation for SEO#375
Conversation
Add schema.org JSON-LD structured data to all 10 template files (5 page types across classic and modern themes): - Home: WebSite schema - Docs: TechArticle schema with headline, description, dateModified - API: WebPage schema - Changelog: CollectionPage schema - Changelog entry: BlogPosting schema with datePublished, image JSON-LD is pre-computed in builder.ts via resolveJsonLd() to ensure proper JSON encoding, then passed to templates as a raw HTML string. https://claude.ai/code/session_01JRBSqcxZQDzjrkghRZmzad
Summary of ChangesHello, 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 significantly improves the SEO capabilities of the Docula builder by introducing automated JSON-LD structured data generation. This feature ensures that various content types, such as documentation, API references, and changelog entries, are properly marked up for search engines, leading to better discoverability and richer search results. The integration is designed to be flexible, adapting to available page metadata and site configurations. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces JSON-LD schema generation for various page types to improve SEO, which is a great feature. The implementation is well-structured and includes comprehensive tests. I've identified a few areas for improvement:
- A potential issue where an invalid schema could be generated for changelog entries if a title is missing.
- A robustness improvement to prevent generating invalid script tags for unhandled page types.
- A minor code duplication that can be refactored for better maintainability.
Overall, these are solid changes. Addressing these points will make the new feature more robust and maintainable.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d29f225c2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Guard against empty headline in changelog-entry BlogPosting schema - Handle undefined schema with safety check after switch statement - Extract duplicated changelog page URL into local variable - Add tests for missing/empty title edge cases https://claude.ai/code/session_01JRBSqcxZQDzjrkghRZmzad
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #375 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 7
Lines 1991 2025 +34
Branches 588 602 +14
=========================================
+ Hits 1991 2025 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
API, changelog, and changelog-entry call sites were passing URLs built from data.apiUrl/data.changelogUrl (which already include baseUrl) to resolveJsonLd and resolveOpenGraphData, which also prepend baseUrl. Use raw path segments instead to avoid double-prefixing on subpath deployments. https://claude.ai/code/session_01JRBSqcxZQDzjrkghRZmzad
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Feature - Adds JSON-LD schema generation for improved SEO and structured data support.
Description
This PR introduces a new
resolveJsonLd()method to theDoculaBuilderclass that generates JSON-LD structured data for different page types:The generated JSON-LD is properly formatted as a script tag and integrated into all page templates (both classic and modern themes). The implementation:
baseUrlconfiguration when constructing URLsTest Plan
Added 11 comprehensive unit tests covering:
All tests pass with 100% code coverage of the new functionality.
https://claude.ai/code/session_01JRBSqcxZQDzjrkghRZmzad