yari icon indicating copy to clipboard operation
yari copied to clipboard

enhance(macros/SeeCompatTable): refer to BC table only if it exists

Open caugner opened this issue 1 year ago • 3 comments

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

image

After

image

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)

caugner avatar Jun 11 '24 22:06 caugner

Need to fix in Deprecated_Header.ejs, secureContext_header.ejs, and baseline-indicator.tsx as well.

OnkarRuikar avatar Jun 12 '24 01:06 OnkarRuikar

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?

caugner avatar Jun 14 '24 22:06 caugner

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.

OnkarRuikar avatar Jun 15 '24 03:06 OnkarRuikar

This pull request has merge conflicts that must be resolved before it can be merged.

github-actions[bot] avatar Nov 06 '24 20:11 github-actions[bot]

The changes look good. Please merge after resolving conflicts.

OnkarRuikar avatar Nov 07 '24 01:11 OnkarRuikar

Closing, as we migrated to rari.

caugner avatar Dec 20 '24 15:12 caugner