Skip to content

Add templates for Web Extensions page types#42204

Draft
pepelsbey wants to merge 2 commits intomdn:mainfrom
pepelsbey:web-extensions-templates
Draft

Add templates for Web Extensions page types#42204
pepelsbey wants to merge 2 commits intomdn:mainfrom
pepelsbey:web-extensions-templates

Conversation

@pepelsbey
Copy link
Member

@pepelsbey pepelsbey commented Dec 2, 2025

Description

It creates templates for six Web Extension page types:

  1. webextension-api-function
  2. webextension-api
  3. webextension-api-event
  4. webextension-api-property
  5. webextension-api-type
  6. webextension-manifest-key

Templates follow a similar structure but have variations depending on the page type needs.

Motivation

Harmonize Web Extensions docs within the section and with the rest of the MDN reference pages.

To do

  • Check how {{WebExtExamples}} works
  • Decide whether to include the Chromium copyright notice

@github-actions github-actions bot added Content:Meta Content in the meta docs size/l [PR only] 501-1000 LoC changed labels Dec 2, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Preview URLs (6 pages)
Flaws (17)

Note! 3 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/MDN/Writing_guidelines/Page_structures/Page_types/WebExtension_API_event_page_template
Title: WebExtension API event page template
Flaw count: 1

  • unknown:
    • must be provided

URL: /en-US/docs/MDN/Writing_guidelines/Page_structures/Page_types/WebExtension_API_page_template
Title: WebExtension API page template
Flaw count: 15

  • macros:
    • Macro webextapiref produces link /en-US/docs/Mozilla/Add-ons/WebExtensions/API/Namespace/Type1 which doesn't resolve
    • Macro webextapiref produces link /en-US/docs/Mozilla/Add-ons/WebExtensions/API/Namespace/Type2 which doesn't resolve
    • Macro webextapiref produces link /en-US/docs/Mozilla/Add-ons/WebExtensions/API/Namespace/property1 which doesn't resolve
    • Macro webextapiref produces link /en-US/docs/Mozilla/Add-ons/WebExtensions/API/Namespace/property2 which doesn't resolve
    • Macro webextapiref produces link /en-US/docs/Mozilla/Add-ons/WebExtensions/API/Namespace/function1 which doesn't resolve
    • and 5 more flaws omitted
  • unknown:
    • must be provided
    • must be provided
    • must be provided
    • must be provided
    • must be provided

URL: /en-US/docs/MDN/Writing_guidelines/Page_structures/Page_types/WebExtension_API_property_page_template
Title: WebExtension API property page template
Flaw count: 1

  • unknown:
    • must be provided

(comment last updated: 2025-12-17 14:00:51)

@pepelsbey pepelsbey force-pushed the web-extensions-templates branch from 4f14a03 to 1e41eb9 Compare December 4, 2025 10:21
@pepelsbey pepelsbey requested review from dotproto and rebloor December 9, 2025 12:30
@pepelsbey pepelsbey force-pushed the web-extensions-templates branch from 1e41eb9 to 8f7b41b Compare December 11, 2025 14:30
Copy link
Contributor

@rebloor rebloor left a comment

Choose a reason for hiding this comment

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

@pepelsbey some initial feedback, focusing only on the properties template at the moment. The goal for having commenced this work from the web extensions point of view was to create a mechanism that made it easy for contributions to be made by other browser vendors. As such, having a simple file that can be copied and modified from the repository with prescriptive contact where possible was our goal. Also, the template descriptions repeat advice so, for example, the information on adding examples could be presented once and referenced.

>
> _Remember to remove this whole explanatory note before publishing._

{{SeeCompatTable}}{{Deprecated_Header}}
Copy link
Contributor

Choose a reason for hiding this comment

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

If these macros are added by the toolchain and there's no need to "add or remove them" why are they in the template?

> - `\{{SeeCompatTable}}` — this generates a **This is an experimental technology** banner that indicates the technology is [experimental](/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#experimental).
> - `\{{Deprecated_Header}}` — this generates a **Deprecated** banner that indicates that use of the technology is [discouraged](/en-US/docs/MDN/Writing_guidelines/Experimental_deprecated_obsolete#deprecated).
>
> You should update or delete the following macros according to the advice below:
Copy link
Contributor

Choose a reason for hiding this comment

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

There appears to be only one macro noted, this sentence suggests there are several.

Comment on lines +56 to +58
> - `\{{WebExtAPIRef("GroupDataName")}}` — this generates the left-hand reference sidebar showing quick reference links related to the current page.
> To generate the correct sidebar for your API, you need to add a `GroupData` entry to our GitHub repo, and include the entry's name inside the macro call in place of _GroupDataName_.
> See our [API reference sidebars](/en-US/docs/MDN/Writing_guidelines/Howto/Write_an_api_reference/Sidebars) guide for information on how to do this.
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't believe this is correct for web extensions, adding a page to the directory structure with the appropriate font matter determines whether it gets into the sidebar.

>
> A number of macro calls appear at the top of the content section (immediately below the page front matter).
>
> These macros are automatically added by the toolchain (there is no need to add/remove):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe this information is correct for web extensions, see https://github.com/mdn/browser-compat-data/tree/main/docs/data-guidelines#webextensions-features-do-not-have-status-blocks

webextensions features do not have status blocks

Web extensions are not governed by any specifications and are up to the browser vendors to design and implement. As such, the status blocks would be identical for all web extensions features. Do not add status blocks to the webextensions folder.

This guideline was adopted since the beginning of the project. for example tabs/sendRequest

So, for web extensions, not only does the macro have to be added manually, but the front matter also needs to be manually updating manually. It's worth noting that, in general, rather than using a templated deprecation message, the Web extensions use a specific deprecation message with information about the replacement feature.


{{SeeCompatTable}}{{Deprecated_Header}}

Begin the content on the page with an introductory paragraph — start by naming the property, saying what WebExtension namespace it is part of, and saying what it represents and how it is used.
Copy link
Contributor

Choose a reason for hiding this comment

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

start by naming the property, saying what WebExtension namespace it is part of – why? Doesn't the page title already tell you this?


Where relevant, describe how the value interacts with other APIs (for example, how to change a setting using a related function).

## Examples
Copy link
Contributor

Choose a reason for hiding this comment

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

No mention of {{WebExtExamples}}?

Copy link
Contributor

Choose a reason for hiding this comment

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

@pepelsbey overall, but I don't have any particular objection to documenting these templates in this manner, I think it would be more useful to provide a usable template file in the directory, such as /content/templates/webextensions/apis/propertyname with this content (WIP]:

---
title: [API name].[property name]
[comment]: # (sasave the file as index.md in a folder that corresponds to the slug)
slug: Mozilla/Add-ons/WebExtensions/API/[API name]/[property name]
[comment]: # (Add status if the property is deprecated or experimental)
status:
  - deprecated
  - experimental
page-type: webextension-api-property
browser-compat: webextensions.api.[API name].[property name]
sidebar: addonsidebar
---

[comment]: # (If this property is experimental include:).
 {{SeeCompatTable}}

[comment]: # (If this property is deprecated include: ).
> [!WARNING]
> This property is deprecated. Use {{WebExtAPIRef("[API name].[property name]")}} instead.

[comment]: # (If the property is an object, for example, a `BrowserSetting` object.).

A {{WebExtAPIRef([API name].[object name])}} object [description of how the property is used, usually one or two short sentences]

[comment]: # (If the property is a simple value, for example, a number, string, or boolean).

[description of the property, usually one or two short sentences]

[comment]: # (If the value is the same for all browsers).

Its value is `[value]`.

[comment]: # (If the property can take multiple values).

This value is a string whose possible values are:

- val 1
- val 2
- val 3

[comment]: # (If the values vary between browsers).

Its value is:

- in Chrome `[value]`
- in Firefox `[value]`
- in Safari `[value]`

[comment]: # (If the property is read-only.)

This property is read only.

[additional guidance or comments as necessary]

[comment]: # (when ththe property includes properties, methods, or events add these as per the API overview page)

[comment]: # (when there are examples for this page and examples on other pages)

## Examples

 ### [example title]

[example description]

 ### More examples

[Links to more examples]

{{WebExtExamples}}

[comment]: # (or, when no examples provided on the page).

## Examples

[Links to more examples]

{{WebExtExamples}}

[comment]: # (or, when no examples provided on this or other pages).

{{WebExtExamples("h2")}}

## Browser compatibility

{{Compat}}

[comment]: # (As required. See the [See also section](/en-US/docs/MDN/Writing_guidelines/Writing_style_guide#see_also_section) in the _Writing style guide_.).

## See also

- link1
- link2
- external_link (year)

Copy link
Member

Choose a reason for hiding this comment

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

+1 on this. See also: https://github.com/mdn/content/blob/main/scripts/content/release-firefox.md?plain=1 which is another good candidate for a templates dir

Co-authored-by: rebloor <git@sherpa.co.nz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Meta Content in the meta docs size/l [PR only] 501-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants