Skip to content

feat: Add JSON-LD schema generation for SEO#375

Merged
jaredwray merged 3 commits intomainfrom
claude/add-json-schema-templates-q4aVp
Mar 22, 2026
Merged

feat: Add JSON-LD schema generation for SEO#375
jaredwray merged 3 commits intomainfrom
claude/add-json-schema-templates-q4aVp

Conversation

@jaredwray
Copy link
Owner

Please check if the PR fulfills these requirements

  • Followed the Contributing and Code of Conduct guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.

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 the DoculaBuilder class that generates JSON-LD structured data for different page types:

  • WebSite schema for home pages
  • TechArticle schema for documentation pages (with optional dateModified and keywords)
  • WebPage schema for API reference pages
  • CollectionPage schema for changelog index pages
  • BlogPosting schema for individual changelog entries (with optional datePublished and image)

The generated JSON-LD is properly formatted as a script tag and integrated into all page templates (both classic and modern themes). The implementation:

  • Respects the baseUrl configuration when constructing URLs
  • Falls back to site-level defaults when page-specific metadata is unavailable
  • Properly handles optional fields (only includes them when data is present)
  • Correctly escapes special characters in JSON output

Test Plan

Added 11 comprehensive unit tests covering:

  • Schema generation for each page type
  • Optional field handling
  • baseUrl configuration
  • Special character escaping
  • Fallback to site defaults

All tests pass with 100% code coverage of the new functionality.

https://claude.ai/code/session_01JRBSqcxZQDzjrkghRZmzad

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
@jaredwray jaredwray changed the title Add JSON-LD schema generation for SEO feat: Add JSON-LD schema generation for SEO Mar 22, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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

  • JSON-LD Schema Generation: Introduced a new resolveJsonLd() method in DoculaBuilder to automatically generate JSON-LD structured data for various page types, enhancing SEO.
  • Multi-Page Type Support: The resolveJsonLd() method supports WebSite for home pages, TechArticle for documentation, WebPage for API references, CollectionPage for changelog indexes, and BlogPosting for individual changelog entries.
  • Template Integration: The generated JSON-LD is seamlessly integrated into all page templates (both classic and modern themes) as a script tag within the HTML head.
  • Robust Data Handling: The implementation correctly handles baseUrl configuration, falls back to site-level defaults for missing metadata, includes optional fields only when data is present, and properly escapes special characters.
  • Comprehensive Testing: Added 11 new unit tests covering all aspects of JSON-LD generation, including different page types, optional fields, baseUrl handling, and character escaping, achieving 100% code coverage for the new functionality.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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
Copy link

codecov bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (52cd38b) to head (7d37ea5).
⚠️ Report is 4 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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
@jaredwray jaredwray merged commit 6f010b1 into main Mar 22, 2026
9 checks passed
@jaredwray jaredwray deleted the claude/add-json-schema-templates-q4aVp branch March 22, 2026 01:09
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