WordPress / gutenberg

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

Page Break block ( core/nextpage ) not working as expected in Full Site Editing #29484

Open bobbingwide opened 3 years ago

bobbingwide commented 3 years ago

Description

Step-by-step reproduction instructions

Using a Full Site Editing theme such as TT1-blocks

  1. Create a post with multiple page page breaks
  2. Save
  3. View
  4. The Pages: links do not appear.

Expected behaviour

Ability to view the individual pages by clicking on the links.

Pages: 1 2 3 4 5 

There should be links for the pages which aren't the current page, with each link containing the page number of the page to view. https://blocks.wp-a2z.org/block/page-break-core-nextpage/2/

n+1 pages where n = number of page break blocks used.

Actual behaviour

The Pages: links do not appear. It is possible to navigate to the other pages. But there are no visual clues. image

Screenshots or screen recording (optional)

Expected results. Unchanged from how it works for a non-full site editing theme. image

Code snippet (optional)

WordPress information

Device information

bobbingwide commented 3 years ago

I also reproduced the problem with TT1 blocks and Gutenberg 10.0.2 as the only active plugin.

carolinan commented 3 years ago

I have confirmed that if I add a page break block to a theme that supports full site editing, the block shows correctly in the site editor and post editor, but not the front.

The page break block also does not work with traditional/PHP based themes that does not add wp_link_pages(). See https://developer.wordpress.org/reference/functions/wp_link_pages/

Looks like without wp_link_pages, <!‐‐nextpage‐‐> which is saved in https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/nextpage/save.js#L7 is not understood?

kjellr commented 2 years ago

@noisysocks: flagging this one as a must-have since it seems like a regression.

alberto-marin commented 2 years ago

Hi, I was curious about this one and made a pull request with something that could fix it: https://github.com/WordPress/gutenberg/pull/37672

Mamaduka commented 2 years ago

I'm removing this issue from WP 5.9 project board since RC1 was released last night.

I think we can go with @alberto-marin's solution for the next minor release.

P.S. I will finish reviewing the PR later today.

Mamaduka commented 2 years ago

37672 will be part of the 5.9, so I will close this issue.

Thank you everyone for contributing ❤️

carlomanf commented 2 years ago

Unfortunately, the fix that was applied for this does not work 100% of the time:

  1. It checks for the core/nextpage block, which will not work for paginated content that was created using the classic editor
  2. It will not print out the page links if plugins use the content_pagination filter to add pagination when <!--nextpage--> is not present in the content

Can we re-open this issue and work on a new fix please?