Skip to content
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

Update the docs build script / files to implement redirects #45669

Open
bph opened this issue Nov 9, 2022 · 3 comments
Open

Update the docs build script / files to implement redirects #45669

bph opened this issue Nov 9, 2022 · 3 comments
Labels
Developer Experience Ideas about improving block and theme developer experience Needs Dev Ready for, and needs developer efforts Needs Technical Feedback Needs testing from a developer perspective. [Type] Developer Documentation Documentation for developers

Comments

@bph
Copy link
Contributor

bph commented Nov 9, 2022

With the documentation expanding, the need to reorganize sections of the Block editor handbook might come up, that would also require to establish redirect rules for the WordPress site. In the sister meta trac issue: https://meta.trac.wordpress.org/ticket/6407 The manifest json is expanded to also hold the redirect information.

{
"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"]
},

redirect_from = array of pages to redirect to the new page.

The manifest.json file is created automatically via the npm run docs:build script, that takes the information from the toc.json file.

@bph bph added [Type] Developer Documentation Documentation for developers Developer Experience Ideas about improving block and theme developer experience Needs Dev Ready for, and needs developer efforts Needs Technical Feedback Needs testing from a developer perspective. labels Nov 9, 2022
@georgeh
Copy link
Contributor

georgeh commented Nov 15, 2022

I'm not sure how best to represent this in toc.json. The current format is an array of objects, where the key is a Markdown file and the value is an array of more objects in the same format. docs/tool/manifest.js uses that to build manifest.json by looking for a Markdown H1 for the title.

My first thought is that there should be a reserved key __meta to set extra metadata about the file, such as redirect_from. So in the example above the toc.json line would be

{ 
    "docs/how-to-guides/format-api.md": [
        "__meta": {
            "redirect_from": ["reference-guides/filters/block-filters"]
        }
    ] 
},

This would allow us to include other metadata changes in the future, such as overrides for title, slugs, or even things like theme.

The other idea I had was to put the metadata as Frontmatter in the Markdown file itself. This has the advantage of putting the changes as close to the file itself and seems a more Markdown-native way to handle it.

@bangank36
Copy link
Contributor

@bph I think this is handled by developer to submit the redirects to WordPress/wporg-developer
Take #54120 for example where the redirects are submitted into WordPress/wporg-developer#274

Old: https://developer.wordpress.org/block-editor/explanations/glossary/
New: https://developer.wordpress.org/block-editor/getting-started/glossary/

@bph
Copy link
Contributor Author

bph commented Sep 15, 2023

Oh yes, i understand the current process. It feels very pedestrian to me. I had quite a few discussions with the meta team respectively @tellyworth and @dd32 how to automate the process of creating the redirects. you can read in the trac ticket linked. My discussion about this issues with @georgeh about how to implement the Gutenberg half of the automation is stuck in the beginning and didn't go anywhere. Maybe @ndiego could revitalize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience Needs Dev Ready for, and needs developer efforts Needs Technical Feedback Needs testing from a developer perspective. [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

No branches or pull requests

3 participants