Adding a new page
To add a new page, follow these 4 steps:
- Create the page under the correct folder
- Regular page
- Create the new file in
docs/pages
- The folder structure corresponds to the navigation structure of the site. For example, a new web component page should be created under
docs/pages/web
, and a new Tooling page should be found underdocs/pages/get_started/developers/tooling
- The file path (and structure in
docs/docs-components/siteIndex.js
) create the URL path for the page, so both the file location andsiteIndex
structure must be accurate to get the expected URL
- Pages that do not fall under a main tab, like Roadmap, live at the root of
docs/pages
- Markdown Page
- Create the file under the correct folder in
docs/markdown
- The folder structure corresponds to the navigation structure of the site. For example, a new iOS component page should be created under
docs/markdown/ios
, and a new Tooling page should be found underdocs/markdown/get_started/developers/tooling
- Add the page name to
docs/docs-components/siteIndex.ts
- Find the appropriate section within the JSON object
- Create an accessibility test for the new page in
playwright/accessibility
- Create a file named
[NEW PAGE TITLE].spec.ts
- The file name should match the page name
- If the page is a duplicate (like Avatar on Web and Avatar on iOS), add a suffix with the platform, like
Avatar_iOS.spec.ts
- Update
docs/docs-components/COMPONENT_DATA.ts
- If this is a net new component, you’ll need to add data under the correct array
- The options are Building Blocks, General Components, Utilities, Figma-only, and Foundation guidelines.
- This info affects the layout of the Component Overview page
- You may also need a new svg to represent this component on the Overview pages. Reach out on Slack if you need assistance with the graphic.
- If this is a new page for an existing component, like the Android page for an existing Web component, update the corresponding data for the object that already exists for that component. (See example)
Moving or Deleting a page
When moving or deleting a page, there are multiple updates needed:
- The organization of
docs/docs-components/siteIndex.ts
- Make sure the data stays in sync with your change
- Any URLs within the docs or component pages referencing the page
- If you’re moving or deleting a page, update any references to that URL
- Information in
docs/docs-components/COMPONENT_DATA.ts
- Ensure any updates are reflected in the JSON data
- The associated
spec.ts
accessibility test- Update the URL or remove the file if deleting a page
- List of redirects in
docs/redirects.js
- A redirect must be added anytime a file is moved to help folks find the new location