enhance(macros/SeeCompatTable): refer to BC table only if it exists
Summary
Fixes https://github.com/mdn/yari/issues/11290.
Problem
The {{SeeCompatTable}} macro refers to the browser compatibility table, even if the page doesn't have one.
Solution
Only show it on pages that have a browser-compat frontmatter key.
Screenshots
Before
After
How did you test this change?
Ran yarn dev locally and checked the following pages:
- http://localhost:3000/en-US/docs/Web/API/WebUSB_API (no BCD table)
- http://localhost:3000/en-US/docs/Web/API/USBInterface (has BCD table)
Need to fix in Deprecated_Header.ejs, secureContext_header.ejs, and baseline-indicator.tsx as well.
Deprecated_Header.ejs,secureContext_header.ejs
These are not trivial fixes, because the reference is in the middle of the text, so I won't fix them here.
baseline-indicator.tsx
@OnkarRuikar This one would be easier to fix, but would you have an example for a page that has a baseline banner but no BCD table?
These are not trivial fixes, because the reference is in the middle of the text, so I won't fix them here.
Easiest way would be to maintain two versions of the whole strings.
@OnkarRuikar This one would be easier to fix, but would you have an example for a page that has a baseline banner but no BCD table?
Looks like as per the implementation it is not possible. We don't have to do anything in the PR for this.
This pull request has merge conflicts that must be resolved before it can be merged.
The changes look good. Please merge after resolving conflicts.
Closing, as we migrated to rari.