Skip to content

feat: enable companion suite prerendering by card ID#2852

Merged
sydseter merged 4 commits intoOWASP:masterfrom
Mysterio-17:feat/cards-browse-by-id
Apr 24, 2026
Merged

feat: enable companion suite prerendering by card ID#2852
sydseter merged 4 commits intoOWASP:masterfrom
Mysterio-17:feat/cards-browse-by-id

Conversation

@Mysterio-17
Copy link
Copy Markdown
Contributor

Description

Currently, the Companion edition was only browsable by reaching its explicit endpoint (e.g., /edition/companion/LLM2/1.0/en). This PR enables users to reach all companion cards directly by requesting their card ID (e.g., /cards/LLMA, /cards/LLM2, etc.), aligning the companion suite with the project's standard card routing behavior.

Fixes: #2850

Changes Made:

  • Pre-rendering Entries Added: Included all entries for the Companion cards (LLM, CLD, FRE, DVO, BOT, AAI) in the entries array in svelte.config.js to ensure they are successfully pre-rendered by SvelteKit during npm run productionbuild.
  • Dynamic Route Loading Patch: Updated src/routes/cards/[card]/+page.server.ts to fetch and load companionCards into the central tracking map alongside mobileCards and webappCards. This fixes the "Card not found" prerender crash that occurs when the router attempts to map the newly added cards.

Testing:

Successfully ran npm run productionbuild and confirmed the build/cards directory reliably compiles and serves all index.html artifacts for every companion card.

AI Usage:

Used AI assistance to identify and fix the missing prerendering routes and backend card loading issue. Code changes were verified manually with a local production build.

Copilot AI review requested due to automatic review settings April 21, 2026 12:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables direct browsing and prerendering of Companion edition cards via standard /cards/{cardId} routes (e.g. /cards/LLMA), matching behavior of other editions and avoiding prerender failures.

Changes:

  • Added Companion card routes (LLM, CLD, FRE, DVO, BOT, AAI) to SvelteKit prerender entries.
  • Updated /cards/[card] server load to include Companion deck cards in the lookup map so prerendering doesn’t crash with “Card not found”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
cornucopia.owasp.org/svelte.config.js Adds /cards/* prerender entries for all Companion card IDs so static builds generate the expected pages.
cornucopia.owasp.org/src/routes/cards/[card]/+page.server.ts Loads Companion cards alongside existing decks so /cards/{id} resolves for Companion card IDs during prerender/runtime.

@Mysterio-17
Copy link
Copy Markdown
Contributor Author

Hello @sydseter , have a look at this whenever you have time.

@sydseter sydseter merged commit 2009ddc into OWASP:master Apr 24, 2026
9 checks passed
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.

Ensure the companion suite can be browsed per card id at https://cornucopia.owasp.org/cards

3 participants