Skip to content

2.1.0

Choose a tag to compare

@PaulArgoud PaulArgoud released this 09 Nov 17:32
· 6 commits to main since this release

SEO compatibility checked on the real plugins, instant chapter turns, a Chapters panel in the editor, a clean uninstall, and posts built with a page builder left alone. Content and settings need no change; no database upgrade.

Added

  • All in One SEO and The SEO Framework integrations, next to Yoast SEO, Rank Math and SEOPress (classes/seo/, one PChap_SEO_Integration per plugin, registered only when the plugin is active; the pchap_seo_integrations filter adds more)

  • bin/check-seo.sh: checks the chapters against the five SEO plugins, installed from wordpress.org on the wp-env site (title, canonical, Open Graph, robots, rel links)

  • Instant chapter turns (WordPress 6.8+): on a chapter, a speculation rule prefetches the navigation and table of contents links when the reader hovers or focuses them (moderate; WordPress only prefetched on the press of the click). WordPress prints speculation rules for visitors who are not logged in, on sites with pretty permalinks. New filters pchap_speculation_rule and pchap_speculation_mode (prerender). Checked in Chrome: hovering the "Continue" link requests the next chapter without a click

  • Tests for custom post types (flat, hierarchical, plain permalinks), and a CI job that runs the suite with a Redis object cache

  • Tests that catch the mistakes of a release: the version of the plugin header, PCHAP_VERSION, block.json, index.asset.php, readme.txt, the README badge and the changelogs must agree; every stylesheet and script the plugin loads must exist (LTR, RTL, minified or not); the block metadata copied in blocks/subpage/index.js must match block.json. tests/test-plugin-loaded.php no longer holds the version, so a release has one place less to change

  • Chapters panel in the document sidebar of the block editor: the chapters of the post, in order (click one to select it and scroll to it), and a Turn N headings into chapters button with a heading level (H2, H3 or H4). Each top-level heading becomes a Chapter block where it stands, with a single undo step and a notice. It runs in the same script as the block (blocks/subpage/index.js), which now depends on wp-plugins, wp-data, wp-components, wp-editor and wp-dom-ready. Checked in the real editor, in English and French

  • Block transforms: a heading or a core page break becomes a Chapter block, and a Chapter block becomes a heading, from the block switcher. The saved markup of the block is unchanged

  • Nine strings of the editor interface, translated in French, German, Spanish and Italian; a fourth screenshot of the panel for the WordPress.org listing

Fixed

  • Page builders: a post built with the Elementor editor showed the whole post on every chapter, and a table of contents next to it, because Elementor replaces the content by its own layout and ignores the pages (checked with Elementor 4.4.0). The plugin now leaves posts rendered by Elementor, Divi (_et_pb_use_builder), Beaver Builder (_fl_builder_enabled) and Bricks (_bricks_editor_mode) alone; only Elementor is tested. New filter pchap_is_builder_post. Posts written in the block or classic editor and displayed with Elementor's Canvas and Full Width templates work as before (checked too)

  • Uninstall (deleting the plugin from the Plugins screen) left traces. With a persistent object cache (Redis, Memcached), the _mpp_data index stayed readable from the cache of each post, and the parsed chapters stayed cached; both are now cleared. The events of the background rebuild are removed whatever their arguments. uninstall.php now uses delete_post_meta_by_key(), wp_unschedule_hook() and wp_cache_flush_group(). A test lets the plugin live (activation, settings, posts, a rebuild, its lock), uninstalls it, and checks that no table holds anything of it

  • SEO plugins, found by testing the real plugins (Yoast SEO 28.8, Rank Math 1.0.281, SEOPress 10.4, All in One SEO 5.0.5, The SEO Framework 5.2.0):

    • All in One SEO set every chapter after the first to noindex, nofollow (its default "noindex paginated pages"). Chapters now get the robots of the post
    • SEOPress gave every chapter the post URL as canonical, which tells search engines each chapter duplicates the first page. The canonical is now the chapter URL
    • Yoast SEO kept the post URL in og:url and in the schema WebPage url of every chapter; both are now the chapter URL
    • Rank Math and SEOPress, whose default title templates have no page variable, gave every chapter the same <title> and the same social titles; All in One SEO and The SEO Framework ended the title with "Page N". The chapter title now appears in the <title> and the Open Graph and Twitter titles of any SEO plugin
    • All in One SEO and The SEO Framework printed their own rel prev/next next to ours
  • The admin stylesheet loads again: 2.0.0 enqueued admin/css/multipage-admin[.min].css, a file renamed to post-chapters-admin[.min].css, so every admin page requested a missing file (404) and the settings screens lost their styles. The style handle is now post-chapters-admin

Changed

  • The stylesheet of the chapters (about 1 KB minified) is printed inline by WordPress instead of being requested as a file: one request less on each chapter. A stylesheet of the theme (css/post-chapters.css) gets the same treatment, within the limit of the core styles_inline_size_limit filter
  • Code structure: PChap no longer holds the SEO and comments code. It moves to two components created with the instance, pchap()->seo (PChap_SEO: document title, rel prev/next links, Yoast SEO / Rank Math / SEOPress) and pchap()->comments (PChap_Comments). The former PChap methods (e.g. pchap_rel_links(), filter_wpseo_replacements(), hide_comments()) still work, as deprecated methods that delegate
  • The settings screens are built from one description per option, pchap_get_settings_sections() and pchap_get_settings_fields(), rendered by pchap_admin_render_option_field(). The twelve pchap_admin_*_callback_*() field callbacks are deprecated wrappers. The HTML of the screens is unchanged

Development

  • WordPress.org listing assets in .wordpress-org/: new screenshots (settings, block editor, a post split into chapters, on WordPress 7.1 with Twenty Twenty-Five), banners (772×250, 1544×500) and icons (128×128, 256×256, SVG)

  • wp-env runs a single environment (.wp-env.json, "testsEnvironment": false, WP_DEBUG and SCRIPT_DEBUG off): composer test:wp-env and CI run PHPUnit in its cli container instead of the deprecated tests-cli container, and the development site at http://localhost:8888 is the same environment (the test run reinstalls its database)

  • The documentation uses npx @wordpress/env@12 instead of npx wp-env (the npm package wp-env is unrelated)

  • bin/build-zip.sh --wporg builds build/post-chapters-wporg.zip for WordPress.org: the same files, without the Update URI header. It passes Plugin Check (mode "new") with no error or warning

Changed

  • The internal helpers are prefixed pchap_ instead of _pchap_, which Plugin Check does not accept (e.g. _pchap_link_page_url() is now pchap_link_page_url(), _pchap_get_valid_option() is now pchap_get_valid_option()). They are private (@access private) and get no deprecated alias
  • The subpage index rebuild queries are written out as literal prepared statements; _pchap_rebuild_candidates_where() is replaced by pchap_rebuild_candidates_args()
  • readme.txt: caption of the third screenshot