Which Product Shows This Page?
Convenient Checkout (CCG) and Optum Wallet are two products on one backend, built from the same
docs/ folder. Every page you write needs to answer one question: who should see it?
- Scope: only pages under
docs/01-business/anddocs/03-Integration/are product-scoped. Everything else follows its folder. - Capabilities: Optum Wallet's surface is narrower than CCG's. Check CCG and Optum Wallet capability exposure for the supported APIs, session modes and widget flows before deciding which product a page belongs to.
Step 1: Pick your situationβ
- π€ Both products need the same page. Go to Task 1
- π― Only one product needs the page. Go to Task 2
- π·οΈ Mostly the same, a few parts differ. Go to Task 3
- π Each product needs its own page at the same URL. Go to Task 4
If about 75% or more of the page stays shared, use Task 3. If less, use Task 4. Two clean pages are easier to maintain than one page full of tags.
Task 1: Both products, unchangedβ
You end up with: one page that both products show.
- Leave
productOnlyout of the frontmatter.
That's it. Most pages are in this group.
Task 2: One product onlyβ
You end up with: a page that only one product's site contains.
1. Choose the productβ
| Frontmatter | Who sees the page |
|---|---|
productOnly: ccg | CCG only |
productOnly: optum-wallet | Optum Wallet only |
2. Or lock a whole folderβ
In the folder's _category_.json, nest the value under customProps:
{ "label": "Upgrade Your Integration", "customProps": { "productOnly": "ccg" } }
Every file inside inherits it. A file can't override or widen its folder's lock, and
scripts/docs/lintProductScope.js fails the build if one tries.
3. Fix the linksβ
A shared page that links to a ccg page has a dead link in Optum Wallet. Wrap that link in
<Product include="ccg"> (see Task 3).
Task 3: Shared page with product-specific partsβ
You end up with: one page. CCG-only parts show a "CCG only" label on the CCG site and disappear from Optum Wallet.
Pick the displayβ
| Tagged content | display |
|---|---|
| π A block (paragraph, table, code sample) | omit it |
| βοΈ Inside a sentence | inline |
π An <li> in a list | list-item |
| ποΈ Cards in a grid | tiles |
Blocks get a collapsible "CCG only" banner. The other displays show a small label or a badge on each card.
Show a different version to each productβ
Put one <Product> for each product next to each other:
<Product include="ccg">Pick any session mode.</Product>
<Product include="optum-wallet">Use `PAYMENT_WITH_WALLET`, the only mode available.</Product>
See plugins/remark-strip-product.js for how the tags are processed.
Task 4: Different pages at the same linkβ
You end up with: two files that share one URL. Each product's site shows its own.
Use this for a folder's landing page (index.md), because the sidebar category and the product
switcher both point at it.
What the folder looks likeβ
docs/01-business/3-Core-Capabilities/
βββ _category_.json β no productOnly here
βββ index.md β productOnly: ccg
βββ optum-wallet-index.md β productOnly: optum-wallet
1. Mark the CCG pageβ
---
slug: /business/core-capabilities
productOnly: ccg
---
2. Add the Optum Wallet pageβ
Name it optum-wallet- plus the CCG file's name:
---
slug: /business/core-capabilities
productOnly: optum-wallet
---
3. Match the slug, position and labelβ
Use the same slug, sidebar_position and sidebar_label in both files. The same URL lets the
product switcher land readers on the equivalent page.
4. Run itβ
Run yarn start or yarn build. The generator rebuilds docs-optum-wallet/ itself.
Do and don'tβ
| β Do | π« Don't |
|---|---|
Use the same slug in both files | Set id: in either file |
| Let the generator copy the file | Put productOnly in the folder's _category_.json |
Why no id:β
The generator strips the optum-wallet- prefix when it copies the file into docs-optum-wallet/,
so optum-wallet-index.md becomes index.md there. That is how the folder's _category_.json
link ("link": { "type": "doc", "id": "index" }) finds the Optum Wallet page. If a folder has no
Optum Wallet page, Optum Wallet gets an auto-generated index instead.
Existing examples: docs/01-business/, docs/01-business/3-Core-Capabilities/ and
docs/03-Integration/4-convenient-checkout-ui/2-widget-capabilities/.
Before you mergeβ
- Every page has the scope you intended (none,
ccgoroptum-wallet). - No shared page links to a page the other product doesn't have.
- Paired pages share a
slug, and you did not setid:. -
yarn lint:docspasses. It checks scope conflicts and CCG-only content leaking into Optum Wallet. - You did not edit
docs-optum-wallet/.
How it worksβ
You don't need this to follow the tasks. Read it before changing the build mechanism.
One build, two instances
docs serves CCG and docs-optum-wallet serves Optum Wallet. A navbar switcher moves readers between them. This is separate from the merchant/internal audience split (DOCS_AUDIENCE).
Generated, never edited
scripts/docs/generateOptumWalletContent.js rebuilds docs-optum-wallet/ from productOnly before every build. It's gitignored.
Symlink or copy
Shared pages are symlinked. Pages with <Product> or <Audience> tags, and Optum Wallet-only pages, are copied. A symlink resolves back to docs/, so only CCG's plugins would process the tags and CCG-only content would leak.
scripts/docs/lintOptumWalletTagLeaks.jschecks for that leak after an Optum Wallet build.- Optum Wallet is on by default.
ENABLE_OPTUM_WALLETindocusaurus.config.jsdefaults totrue. Set it tofalse, or pass--disable-optum-wallettoscripts/docs/runAudienceDocusaurus.js, to build without it. It's never registered for a merchant build.