Making WordPress.org

Opened 2 years ago

Last modified 20 months ago

#6407 new feature request

Add 301 redirect information to Block Editor Handbook

Reported by: bph's profile bph Owned by:
Milestone: Priority: normal
Component: Developer Hub Keywords: dev-feedback needs-patch
Cc:

Description

When updating a page for the block editor handbook, once in a while, the page's slug or URL
Examples:

  • Single page's slug changes: block-filters to block-hooks
  • Single page's parent folder changes old: reference-guides/filters/block-filters new: reference-guides/hooks/block-hooks
  • Two pages are combined into a third. old: reference-guides/filters/block-filters old: reference-guides/filters/block-actions new: reference-guides/hooks/block-hooks

In all this cases, the import process would need to accommodate also 301 redirects from the old pages to the new pages, so links to the old pages won't go dead.

Currently, the manifest page object reads:

{
"title": "Block Filters",
"title": "Block Hooks",
"slug": "block-filters",
"markdown_source": "../docs/reference-guides/filters/block-filters.md",
"parent": "filters",
},

For the updated pages the manifest would look like this, with a possible new field "redirect_from"

{
"title": "Block Filters",
"title": "Block Hooks",
"slug": "block-hooks",
"markdown_source": "../docs/reference-guides/hooks/block-hooks.md",
"parent": "hooks",
"redirect_from":["reference-guides/filters/block-filters"]
},

Note: redirect_from is an array, in case it needs more than one value, to cover the third examples, when there needs a redirect from two old pages to a single new page.

Then it would look something like this:

"redirect_from":["reference-guides/filters/block-filters", "reference-guides/filters/block-actions"]

With this information, the import script could create the 301 redirect strings on when importing the new docs.

Maybe new location string should have a "../docs/" for accuracy?

I am not familiar where and how the magic works on server level for for the block editor handbook. So, there are still a few blind spots that need to be filled.

Change History (2)

#1 @bph
2 years ago

  • Summary changed from Add 301 redirect information to manifest to Add 301 redirect information to Block Editor Handbook

#2 @bph
20 months ago

Created a sister issue on Gutenberg repo for the changes to the build command of the tool creating the manifest.json file.
https://github.com/WordPress/gutenberg/issues/45669

Note: See TracTickets for help on using tickets.