Skip to content

Add sidebar.yml generation script for shopify-dev docs#3508

Open
kdaviduik wants to merge 1 commit intomainfrom
kd-sidebar-generation-script
Open

Add sidebar.yml generation script for shopify-dev docs#3508
kdaviduik wants to merge 1 commit intomainfrom
kd-sidebar-generation-script

Conversation

@kdaviduik
Copy link
Contributor

@kdaviduik kdaviduik commented Feb 26, 2026

Summary

  • Adds a reusable Node.js script (docs/generate-sidebar.cjs) that generates sidebar.yml files for the shopify-dev repo
  • Replaces manual sidebar editing when adding new calver versions of Hydrogen/Hydrogen React docs

Usage

# After building docs (build-docs.sh), generate the sidebar:
node docs/generate-sidebar.cjs hydrogen 2025-10 \
  packages/hydrogen/docs/generated/generated_docs_data.json \
  /path/to/shopify-dev/content/api/hydrogen/2025-10/sidebar.yml

How it works

  1. Reads generated_docs_data.json (the build output)
  2. Groups entries by categorysubCategory
  3. Sorts alphabetically within groups
  4. Outputs YAML with correct sidebar keys (hydrogen_2025_10) and URL paths
  5. Validates input data — fails clearly if the schema has changed

Test plan

  • Used this script to generate sidebar.yml for 2025-10 and 2026-01 (both hydrogen and hydrogen-react)
  • Verified entry counts match JSON data (88 hydrogen, 43 hydrogen-react)
  • Verified YAML keys match existing 2025-07 convention
  • Verified URL slugs match existing patterns

🎩 you can see this PR where I used it

Adds a reusable Node.js script that generates sidebar.yml files for shopify-dev from the generated_docs_data.json output. This replaces manual sidebar editing when adding new calver versions.

The script groups entries by category/subCategory, sorts alphabetically, and produces YAML matching the shopify-dev convention. It validates input data and fails clearly if the schema has changed.
@shopify
Copy link
Contributor

shopify bot commented Feb 26, 2026

Oxygen deployed a preview of your kd-sidebar-generation-script branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment February 26, 2026 4:19 AM

Learn more about Hydrogen's GitHub integration.

@kdaviduik kdaviduik marked this pull request as ready for review February 26, 2026 05:00
@kdaviduik kdaviduik requested a review from a team as a code owner February 26, 2026 05:00
Copy link
Contributor

Choose a reason for hiding this comment

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

we can make this a ts file and run it with node --experimental-strip-types generate-sidebar.ts or even without the flag in node 24.

would also advocate in favour of creating a command in the root package.json to make it more discoverable. it can build docs → generate sidebar

when are we expected to run this? is this automated? id love some more context

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