-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix up MDN API landing page template for browser-compat #5225
Conversation
Preview URLs
FlawsNote! 2 documents with no flaws that don't need to be listed. 🎉 URL:
URL:
URL:
External URLsURL: No new external URLs URL: No new external URLs URL: No new external URLs URL: No new external URLs URL: No new external URLs (this comment was updated 2021-06-04 06:57:45.443805) |
Thanks for doing this @hamishwillee ! Definitely needed, and this general update looks fine. Having said that, I'm not actually sure yet whether we will be doing this for API pages in particular. See https://github.com/mdn/content/discussions/4920. What you've written here definitely applies for https://developer.mozilla.org/en-US/docs/MDN/Structures/Page_types#css_feature_reference_page and very likely: https://developer.mozilla.org/en-US/docs/MDN/Structures/Page_types#api_reference_subpage ...and of course JS, which does not seem to be documented here... This update could also talk about using the {{Specifications}} macro, instead of a handwritten table. |
Hi @wbamberg, Thank you for the feedback. IMO there isn't any reason not to roll this out to API docs and everywhere else. Even if we are sporadic about roll out, the howto docs should reflect a consistent approach. I will add update for |
@wbamberg et al, OK I did a further update to add info on how to update the specifications table. That lead me to wondering how you update the
Anyway, needs a re-review before I go and roll everything out everywhere :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this!
For API landing pages specifically, it's not at all obvious to me that the approach of adding a single BCD query into front matter makes sense, because the tech covered by a single API landing page doesn't correspond to a single BCD query. For example, which single query would you use to describe the compat status of the WebRTC API: https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API ? |
Re #5225 (comment) "For API landing pages specifically, it's not at all obvious ..." OK, I get you. Part of the problem is that it is not all that clear in the original doc. At the moment it talks about just one compat table. What I think this should say is that you may find it useful to display BCD tables for the main interfaces in an API - so work out the keys for each of them and put them in compatibility section using separate compat macro (or something similar). Does that make sense? For now I have just reverted that section. If so, what about specifications? That macro does not take a BCD entry. So do we say "create your own table" or do I remove this section, or what? FURTHER ... |
|
||
<p>The compatibility and specification tables corresponding to the key are then automatically rendered in place of the <code>\{{Compat}}</code> and <code>\{{Specifications}}</code> macros in the source.</p> | ||
|
||
<p>You can also specify the desired API as the first argument to the macro as shown: <code>\{{Compat("api.AbortController")}}</code>. This can be useful if multiple compatibility tables are required on the same page.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, this is also true for specification tables, see https://github.com/mdn/yari/blob/main/kumascript/macros/Specifications.ejs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Elchi3. I did test that and it didn't work. Must have made a mistake. Will try again.
The specification macro can actually take a BCD query if needed. I think having a manual spec table is fine as the exception, too, though. I mean it is just links to specs really. If certain pages need something more fancy, then I would decide on a case by case basis. The majority of reference-type pages should be fine with just {{Specifications}} imo. |
Great news. I did test this, which is why I thought it did not work. Will retest and update appropriately. |
ba55aba
to
c3d2e83
Compare
Co-authored-by: Florian Scholz <[email protected]> Update files/en-us/mdn/structures/compatibility_tables/index.html Co-authored-by: Florian Scholz <[email protected]> Update files/en-us/mdn/structures/compatibility_tables/index.html Co-authored-by: Florian Scholz <[email protected]> Update files/en-us/mdn/structures/compatibility_tables/index.html Co-authored-by: Florian Scholz <[email protected]> Update files/en-us/mdn/structures/compatibility_tables/index.html Co-authored-by: Florian Scholz <[email protected]>
c3d2e83
to
cf67170
Compare
@Elchi3 I've rebased to master and modified the API Landing page to improve the browser compat and specifications sections as discussed. It now says
Can you please review and (ideally) merge. After I'll roll out more broadly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks Hamish!
The new way of doing browser compatibility sections is to list the BCD path in the page frontmatter
browser-compat
key and just use{{Compat}}
as a placeholder. Also we no longer have hidden sections.This fixes just one template: https://developer.mozilla.org/en-US/docs/MDN/Structures/Page_types/API_landing_page_template. If this is merged I'll do the other MDN instructional docs/templates - e.g. https://developer.mozilla.org/en-US/docs/MDN/Structures/Page_types/SVG_element_page_template
This follows follows on naturally from #4398 and #2228
@wbamberg @Elchi3 Sanity check would be good :-)