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

Site Editor: certain themes fail to load static homepage content #88219

Closed
fushar opened this issue Mar 6, 2024 · 12 comments · Fixed by Automattic/themes#7680
Closed

Site Editor: certain themes fail to load static homepage content #88219

fushar opened this issue Mar 6, 2024 · 12 comments · Fixed by Automattic/themes#7680
Labels
[Feature] Full Site Editor The site editor. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Platform] Atomic [Platform] Simple [Pri] High [Product] WordPress.com All features accessible on and related to WordPress.com. [Status] Priority Review Triggered Quality squad has been notified of this issue in #dotcom-triage-alerts Triaged To be used when issues have been triaged. [Type] Bug

Comments

@fushar
Copy link
Contributor

fushar commented Mar 6, 2024

Quick summary

When the homepage is set to show a static page, Site Editor will show blank page instead of the static page content. Only happens to certain themes. I tested Bedrock.

This issue is not reproduced on self-hosted site, or on Atomic sites which have Gutenberg plugin disabled.

The workaround is to edit the home page in Page Editor, but it might be not intuitive.

Steps to reproduce

  1. Activate Bedrock theme
  2. Go to Settings -> Reading
  3. Set a static page as homepage
  4. Open Site Editor

What you expected to happen

The page content

image

What actually happened

I see blank page

image

Impact

Most (> 50%)

Available workarounds?

Yes, easy to implement

Platform (Simple and/or Atomic)

Simple, Atomic

Logs or notes

No response

@fushar fushar added [Type] Bug Needs triage Ticket needs to be triaged [Feature] Full Site Editor The site editor. [Product] WordPress.com All features accessible on and related to WordPress.com. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. labels Mar 6, 2024
@arthur791004
Copy link
Contributor

Here are my findings:

  • The static homepage of the bedrock theme contains bedrock/page pattern with a template part
  • When the “homepage displays” is configured to a static page, the post type is weird.
    • It may become the “Page” post so the post type is page. See here.
  • We have a hook, useHideBLocksFromInserter, that adds a filter to filter out the template part if the post type is not one of wp_block, wp_template, and wp_template_part
  • As a result, some blocks of this pattern cannot be inserted into the canvas, resulting in an empty content

So the issue becomes what's the “CORRECT” post type when you open the side editor to edit a static homepage?

@fushar
Copy link
Contributor Author

fushar commented Mar 6, 2024

Corresponding GB issue: WordPress/gutenberg#59634

Should we close this one? cc: @liviopv I am not sure

@fushar
Copy link
Contributor Author

fushar commented Mar 7, 2024

@iamtakashi, based on the GB issue linked above, it looks like it's caused by the theme.

Bedrock theme's Pages template consists of a single bedrock/page pattern, which in turn contains template parts (header/footer). Looks like this is not supported? Should we "flatten" the contents of bedrock/page pattern into the Pages template instead?

@rickmgithub rickmgithub added Triaged To be used when issues have been triaged. [Pri] High and removed Needs triage Ticket needs to be triaged [Pri] Normal labels Mar 7, 2024
@rickmgithub
Copy link

📌 REPRODUCTION RESULTS

  • Tested on Simple – Replicated
  • Tested on Atomic – Replicated

Problem seen as per OP instructions.

📌 ACTIONS

Triaged

@github-actions github-actions bot added the [Status] Priority Review Triggered Quality squad has been notified of this issue in #dotcom-triage-alerts label Mar 7, 2024
@iamtakashi
Copy link
Contributor

it looks like it's caused by the theme. [...] Looks like this is not supported? Should we "flatten" the contents of bedrock/page pattern into the Pages template instead?

@fushar As far as I've tested, this approach is fine on self-hosted or Atomic sites. Something strange must be going on simple sites, and that should be fixed at the root rather than blaming or taking a different approach in the theme. Otherwise, WP.com will have more themes like this, and there is no way to stop themes from doing the same thing if they work elsewhere. In fact, this issue blocks Low Fi.

@iamtakashi
Copy link
Contributor

Isn't this issue the same as #87770 ?

@iamtakashi
Copy link
Contributor

This issue is not reproduced on self-hosted site, or on Atomic sites which have Gutenberg plugin disabled.

Were you able to reproduce the issue on Atomic if the Gutengerg plugin is activated? Your screenshot seems that way.

@fushar
Copy link
Contributor Author

fushar commented Mar 13, 2024

@fushar As far as I've tested, this approach is fine on self-hosted or Atomic sites. Something strange must be going on simple sites, and that should be fixed at the root rather than blaming or taking a different approach in the theme.

Were you able to reproduce the issue on Atomic if the Gutengerg plugin is activated? Your screenshot seems that way.

@iamtakashi I checked again and I can replicate in simple, Atomic, and self-hosted sites using the latest Gutenberg version (17.8.2 as of this report). See also @rickmgithub's comment above where he can replicate it on Atomic (which activates latest Gutenberg by default).

So, this is not a dotcom-only bug. I'm not sure if Gutenberg breaks something or it's actually a "bugfix". One solution is to try older GB versions until we find the first version which introduced this behavior. cc: @annezazu

Isn't this issue the same as #87770

No, this is a different thing altogether.

@iamtakashi
Copy link
Contributor

@fushar, My apologies, I spoke too soon. I thought it was the same issue as #87770. I can also replicate this issue in my local install with the Gutenberg trunk activated.

I can't turn the page pattern into an HTML page template because it uses a cover block and needs PHP to print the image's URL.

We can open the page template by clicking it from the list in the editor, but we can't open it during the initial load. If I temporarily remove the header template part from the page pattern, we can open it without an issue. But it breaks if I add the template part back in. Weirdly, if I wrapped the header template part with a group in the pattern, I was able to open it. This seems to be a Gutenberg issue.

@dsas
Copy link
Contributor

dsas commented Mar 14, 2024

I can't turn the page pattern into an HTML page template because it uses a cover block and needs PHP to print the image's URL.

You can register patterns with PHP though, shouldn't that work?

Edit: Sorry I misunderstood.

@iamtakashi
Copy link
Contributor

I'll move the template parts out from the patterns and add them to the templates.

@iamtakashi
Copy link
Contributor

I'm not sure when but it wasn't an issue until recently. Anyway, the linked PR above should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Full Site Editor The site editor. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Platform] Atomic [Platform] Simple [Pri] High [Product] WordPress.com All features accessible on and related to WordPress.com. [Status] Priority Review Triggered Quality squad has been notified of this issue in #dotcom-triage-alerts Triaged To be used when issues have been triaged. [Type] Bug
Development

Successfully merging a pull request may close this issue.

5 participants