WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.45k stars 4.17k forks source link

New block: Editor content block - seeing template content in the backend of the associated page #62596

Open paaljoachim opened 4 months ago

paaljoachim commented 4 months ago

What problem does this address?

NB. This issue is very likely associated with other similar issues.

An example. Adding content to the Pages template. Like so:

Screenshot 2024-06-15 at 10 43 11

Going to edit a page. Content added to the template will not be seen in the backend of the associated page. Screenshot 2024-06-15 at 10 44 52

It does not give a hint that there is content added to the Page template.

One can only see the added Page template content by viewing the page on the frontend. Screenshot 2024-06-15 at 10 46 47

This is not user friendly as the backend shows something different compared to the frontend.

What is your proposed solution?

We have the Post Content block in the Site Editor templates. It can not directly show the content as the content will be different for each page, but it gives us a hint to where the individual page content is located.

An Editor Content block can be used when additional content has been added to a template. Pages template. Going to edit a page. One would then see something like this added template content when editing a page.

Screenshot 2024-06-15 at 10 53 28

It will become visible in the backend of all pages what content the Pages template has added. This will make it possible to add Template content seen in each page. One could then setup a template for a specific page / CPT / Role and see it in the associated type of page. Clicking the Editor Content block a popup could perhaps be seen that can say go to Edit the Template or change the Template information to become a unsynced pattern to be used only for this page.

One could block the user from editing the template keeping the option in the popup to create an unsynced pattern. This way one can add placeholders to the template and when the user goes to edit an associated page and click to have the template content unsynced the user would have to just fill in the placeholder blocks. Or when the user goes to edit an associated page that the template content is automatically unsynced so the user just fills in the blocks where the information is needed. (Learn does something similar here.)

One could block the user from creating an unsynced pattern then the option would be go to and edit the template. One could block the user from doing anything keeping it locked. Similar to the Cart page in WooCommerce.

Associated video: https://youtu.be/CFwEMRBxa3s?si=NHkPVkom2PL83Pud

Use case. WooCommerce. Cart page: Shows a Locked Filled Cart which can not be edited as this is only done in the associated Page: Cart template. Checkout page: Shows template content which can be edited through the Checkout page. Meaning one can edit the Checkout page or the Page: Checkout template. My account page: Shows a Shortcode. (Needs work) No template yet. Shop page: Is blank. Does not show associated template name. It might be using the the Product Catalog template.

annezazu commented 4 months ago

Why would you not just use the “show template” option to see the full template? I don’t think we should be showing any piece of the template there otherwise and don't think this warrants a new block that also overlaps with the idea of "content".

It does not give a hint that there is content added to the Page template.

This is because you shouldn't put post or page content into a template. This is part of the work that's been done here https://github.com/WordPress/gutenberg/issues/55025 to make it clearer when you're adding content in each section.