Skip to content

Edit Site: Add routes or query args to get URIs for individual templates #22238

@ockham

Description

@ockham

We're currently using the template selector dropdown to switch between individual templates (and template parts), which uses component context and state to set the currently selected template, while the URL stays the same (/wp-admin/admin.php?page=gutenberg-edit-site).

I think we should provide a way to point to the Site Editor with a specific template selected, so that we can link to it e.g. from other parts of wp-admin, or other admin panels and contexts.


This could be something like /wp-admin/edit-site.php?template=page&action=edit&amp. We should take into account how to modify the route once we implement context loading (and want to specify which context/entity should be loaded). We could make it /wp-admin/edit-site.php?template=page&action=edit&entity=123, where entity is the ID of the page/post/category/... we're interested in. I'm not entirely sure if this route format can scale to all parts of the template hierarchy, even if we decide to leave out a few template types, since some template types cannot be specified via an ID (think a yearly archive). The most natural way to refer to an entity would be that entity's route, so maybe we should consider something like /wp-admin/edit-site.php?template=page&action=edit&entity=/about.

(There's a point to be made that this route may be overdefined: The route to an entity already implies the part of the template hierarchy that matches it best; and some templates are incompatible with some entities (can't use a page template for a category archive). So we could theoretically drop the template arg from the route. But this gets us into somewhat deep waters where we might end up reasoning about where to draw the line between site and content editing 😬 )

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions