As Fuchsia evolves, there is a need to deprecate documentation for deprecated
features or out-of-date documentation.

## Establish a deprecation timeline

Before removing documentation, it is important to establish a deprecation
timeline and notify users. In general, it is recommended to remove documentation
after a deprecation period of 6 months.

To begin the deprecation process and notify users:

- [Deprecate a document in its markdown file](https://fuchsia.dev/fuchsia-src/contribute/docs/deprecating-docs#deprecate-doc)
- [Deprecate a document in the navigation](https://fuchsia.dev/fuchsia-src/contribute/docs/deprecating-docs#deprecate-toc)

## Deprecate a document in its markdown file

To mark a document as deprecated in markdown file:

1. Locate the title of the page which is prefixed with a `#`. For example:

       # Deprecating documentation

2. Add the following `include` statement below the title of the document. For
   example:

       # Deprecating documentation

       {% include "fuchsia-src/_common/_deprecation_notice.md" %}

3. Include information about the deprecation for users such as the
   reasoning behind the deprecation. Also, include any new tools or features
   that may now be in place instead of the deprecated feature.

4. [Mark the document as deprecated in the navigation](https://fuchsia.dev/fuchsia-src/contribute/docs/deprecating-docs#deprecate-toc).

## Deprecate a document in the navigation

> [!NOTE]
> **Note:** For more information on working with the fuchsia.dev navigation, see [Updating site navigation and TOC files](https://fuchsia.dev/fuchsia-src/contribute/docs/documentation-navigation-toc).

To mark a document as deprecated in a `_toc.yaml` file:

1. Locate the `_toc.yaml` file that references the documentation that you are
   deprecating. For example:

   > [!NOTE]
   > **Note:** By convention, the `_toc.yaml` file should be in the same directory as the markdown file that you are deprecating.

       - title: "Deprecating documentation"
         path: /docs/contribute/docs/deprecating-docs.md

2. Add a key/value pair of `status: deprecated` under the title of the page. For
   example:

       - title: "Deprecating documentation"
         status: deprecated
         path: /docs/contribute/docs/deprecating-docs.md

3. Submit the changes (document and TOC deprecation) to the Fuchsia repository.

## Redirect the pages to the deprecation notice

After the deprecation timeline has passed, delete the pages and redirect them.

To delete the pages and redirect:

1. Search for any links that reference the pages that you are removing. For
   example:

       grep -r "/docs/contribute/docs/deprecating-docs.md" ~/fuchsia/docs/

   This lists all the documents that link to the page from the `grep` command.
2. Update or remove any links in documentation that references the pages that
   you are deprecating.

3. Use `git rm` to remove the documents that you are deprecating. For example:

       git rm docs/contribute/docs/deprecating-docs.md

4. Locate the `_toc.yaml` files where the documents are referenced and remove
   the entries for the deprecated documents.

5. Ensure that `doc-checker` passes. Run `fx lint` to run doc-checker:

       fx lint

   Fix any issues that `doc-checker` may signal.
6. In the [`/docs/_common/_deprecated-docs.yaml`](https://fuchsia.dev/docs/_common/_deprecated-docs.yaml) file, create
   a redirect for the deprecated pages to the
   [deprecation notice](https://fuchsia.dev/docs/contribute/docs/deprecation-notice) page. Also include a comment listing
   the deprecate feature with a deprecation date. For example:

   > [!NOTE]
   > **Note:** # Using ? or \* is not supported in the redirect links.

       # May 13th, 2022
       # Deprecating documentation around deprecation
       - from: /docs/contribute/docs/deprecating-docs.md
         to: /docs/contribute/docs/deprecation-notice.md

7. Submit the changes to the Fuchsia repository.

[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/contribute/docs/deprecating-docs.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/contribute/docs/deprecating-docs.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/contribute/docs/deprecating-docs.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/contribute/docs/deprecating-docs.md "Edit the source code of this page")