-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Edit Site: Add routes or query args to get URIs for individual templates #22238
Comments
The context is specified by
I don't see why. |
Not sure I understand -- how comes
Imagine a route to the Site Editor that specifies a context to render, but infers the corresponding template from that (such as |
If they don't have permission to edit the layout, for example, the editors could also merge in the future. |
This has been added in #27124. |
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&
. 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
, whereentity
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 😬 )The text was updated successfully, but these errors were encountered: