-
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
Warn users prior to removal of critical blocks in blog templates #40618
Comments
This feature would also be great for 3rd party blocks. I can think of 2 different ways of approaching it. 1. On a Block LevelThe first thing that came to mind was building this out as a block support property that blocks can define.
{
"supports": {
"warnBeforeRemoval": true
}
} {
"supports": {
"warnBeforeRemoval": [ 'single-post', 'single-page' ]
}
} _Note: Not an actual API. Just as an example 2. On a Template LevelAnother option is to expose this level of control on the template level. In either case, it should be filterable by theme / plugin authors. For the Post Title for example there are also other 3rd party blocks that save to the post title field and therefore are an actual replacement and it can make sense to have other recommended blocks than vanilla core would have :) |
The block level approach sounds good as it would allow us to cover things like removing Post Template from Query Loop – something that can happen in both the site editor and the post editor. |
Could it also be locked, or is there a use case for removing Post Template? |
Perhaps edge cases like elaborate designs where you want pagination in a different location to the posts list? 🤔 |
I think this is a good opportunity to communicate the more intricate aspects of templates and content management, so we should be more forthcoming on why something is not advised — "this block is what displays the content of your posts, removing it would mean all your posts show empty in their permalink" or something. |
Based on experience with the FSE Outreach Program, I think this would go a long way towards guiding folks towards interacting with the pieces of the site editor/site editing experience appropriately/in a way that will lead to the outcomes they might want. Keen to get something in place and do a round of testing! |
There's quite a lot of nuance to consider here. Removing a Query block from the Home template might yield a different message to removing it from the Index, Front Page, or Tag template. If comments are disabled for a particular post / post type, then we don't need to display a warning. The first step is probably to identify which blocks prompt a warning, and then come up with generic-but-useful messages for each of them, and the basic conditions upon which they appear. |
Should we consider custom handling to just a few of these blocks for now before looking at an abstraction(like supports)? |
It would be good to handle some of the more important cases. Post Content on Singular templates, and Query Loop on archive templates spring to mind. |
I agree there are some core blocks that really should get this sooner than later so it might make sense to add a custom solution for them first. But I do want to also make the case that third-party blocks are very much in need of this as a standardized API. So it would be great if custom solutions don't mean that we never get a public API for it :) |
Let's start with custom handling until the UX is sorted out and proven. |
Can we start just with post content and query blocks in blog templates? |
This is important; including the "why". |
In the site editing context there are certain blocks that you shouldn't delete outside of edge cases – Post Content and Query Loop can cause a lot of damage if removed. It would be good to display a confirmatory modal when the user attempts to remove them.
To begin with we can display this when editing a blog template (Index / Home). But it would be good to expand that to include archive and singular templates after.
The text was updated successfully, but these errors were encountered: