Flx Modernize

Description

Flx Modernize sends the content of a page to a Flx Render service, which returns the finished HTML page. Visitors see a modern, fast page that keeps your theme’s design. WordPress stays the source of all content, and if the Render service is unavailable, WordPress renders the page itself, so the site never breaks.

This release supports sites using the Twenty Twenty-Five theme. A Twenty Twenty-Five renderer package is available from modernize.flexplat.com; you can run it yourself or have it hosted for you.

See it in 60 seconds

The same WordPress page with Contact Form 7 and a jQuery lightbox, first in a typical Next.js + REST API front end, then rendered by Node.js with Flx Modernize. Try it yourself on the plugin demo page (visit it logged out).

What is rendered through Flx

  • The blog home page, category and tag archives
  • Single posts and pages
  • Search results
  • The “Page not found” (404) page, still sent with a real 404 status

The theme’s header with its menu, and its footer, appear on every one of these pages. What your plugins print in the page head and footer carries over too: the title, SEO tags (for example from Yoast SEO), structured data and scripts such as analytics. So do plugin styles, and plugin scripts together with the WordPress scripts they need, such as jQuery.

What always stays normal WordPress

  • Anyone who is logged in (administrators and editors always see normal WordPress)
  • Previews, drafts, private, scheduled and password-protected content
  • Feeds, embeds, robots.txt, trackbacks and any request other than GET or HEAD
  • Visitors who have commented (WordPress’s comment cookies), and reply or “awaiting moderation” links, so they see their own pending comment and a filled-in form

Safety

  • Only anonymous visitors get Flx pages, and the page data is built as an anonymous visitor.
  • No visitor data is sent to the Render service: no cookies, no user account and no query-string values. The one exception is the words a visitor searches for, because the search results page shows them.
  • Requests to the Render service can be signed with a key only your site holds; a Render service in enforce mode rejects anything else.
  • Flx pages are sent with Cache-Control: private, no-store, unless you turn on edge caching (below). A page served by WordPress because the Render service failed is always sent with no-store.
  • Deactivating the plugin instantly returns the whole site to normal WordPress.

Edge caching (optional)

Off by default. Add define( 'FLX_MODERNIZE_EDGE_TTL', 300 ); to wp-config.php (seconds, 60 to 3600) and Flx pages that are the same for every visitor can be stored by your CDN: pages, single posts, the blog home page and category and tag archives, requested without a query string. They are sent Cache-Control: public, max-age=0, s-maxage=<TTL>. Search results, the 404 page, URLs with a query string, fallback pages and everything WordPress renders itself (logged-in users, previews, password-protected content) are never cached.

With FLX_MODERNIZE_CLOUDFLARE_ZONE_ID and FLX_MODERNIZE_CLOUDFLARE_API_TOKEN (a token that can only purge cache) also defined, the plugin clears your site from Cloudflare’s cache after any change that can show on a page. Your CDN must be set to follow the origin’s Cache-Control header; the documentation at modernize.flexplat.com shows the Cloudflare Cache Rule.

For developers

The flx_modernize_should_render filter lets you turn Flx off for a request (return false). It can never turn Flx on for a logged-in user.

The flx_modernize_head_footer_output filter turns off the head and footer output (return false).

Documentation and a step-by-step tutorial for building a renderer for a theme are at modernize.flexplat.com.

External Services

Flx Modernize works by sending page data to an external Flx Render service over HTTPS and displaying the HTML it returns.

  • Which service: the one whose URL an administrator enters on the Flx Modernize settings screen. It can be your own self-hosted instance (the renderer package is GPL-licensed open source) or one hosted for you. There is no default: until a Render URL is saved, the plugin sends nothing anywhere and WordPress renders every page normally.
  • When data is sent: only when an anonymous visitor requests a page that Flx renders (see the lists above).
  • What is sent: the content needed to draw that page: title, content, excerpt, slug and permalink; publish and modified dates and author display name; featured image URL, size and alt text; site name, home URL and site language; the header menu’s labels and links; links to the site’s own theme CSS (which the Render service then fetches from your site); for archives and search, the list of posts and paging; for posts, the author’s archive link, the post’s categories and tags, the previous and next posts (title and link), the four latest posts for the theme’s “More posts” list, and the comments section as WordPress renders it for an anonymous visitor (approved comments with their author names, avatars and links, and the empty reply form); for search, the search words and the four latest posts (title, link and date) for the theme’s “More posts” list; the SEO tags, structured data (JSON-LD) and scripts that your plugins print in the page head and footer, captured as an anonymous visitor without cookies (styles and WordPress’s own scripts are left out). The filter flx_modernize_head_footer_output turns this off. The filter flx_modernize_comments_html can change or remove the comments section.
  • What is never sent: visitor cookies, IP addresses, user accounts, email addresses, passwords or other query-string values.

Cloudflare API (optional). Only when an administrator has defined FLX_MODERNIZE_EDGE_TTL, FLX_MODERNIZE_CLOUDFLARE_ZONE_ID and FLX_MODERNIZE_CLOUDFLARE_API_TOKEN in wp-config.php: after a change that can alter public pages (for example a post published or a menu saved), the plugin asks Cloudflare to clear its cache for the site’s host name. It sends the zone ID, the token (as the Authorization header) and the site’s host name to api.cloudflare.com; nothing about visitors is sent. Without these constants the plugin never contacts Cloudflare. Cloudflare’s terms and privacy policy apply.

The Render service is operated by whoever hosts it: you, or the provider you choose. When the hosting is provided by Flx (Rickey Gu), the terms are agreed with you directly; see modernize.flexplat.com.

Installation

  1. Install and activate Flx Modernize from the Plugins screen.
  2. Set up a Flx Render service for your theme (see modernize.flexplat.com), or have one hosted for you.
  3. Recommended: add a signing key to wp-config.php, with the same key configured on the Render service:
    define( ‘FLX_MODERNIZE_RENDER_KEY_ID’, ‘your-key-id’ );
    define( ‘FLX_MODERNIZE_RENDER_SIGNING_SECRET’, ‘a-long-random-secret’ );
  4. Go to Flx Modernize in wp-admin, enter the Render service URL and save.
  5. Visit your site while logged out: pages are now served through Flx. While logged in you keep seeing normal WordPress.

FAQ

Which themes are supported?

Twenty Twenty-Five in this release. Each theme needs a renderer that knows its design; the tutorial at modernize.flexplat.com shows how one is built.

What happens if the Render service is down?

WordPress renders the page itself, automatically, and sends it with Cache-Control: no-store so the fallback page is not cached.

Why do I still see normal WordPress?

Because you are logged in. Flx serves anonymous visitors only. Open the site in a private window to see the Flx pages.

Does it work with page-cache plugins?

Flx pages tell page-cache plugins not to store them (DONOTCACHEPAGE) and send Cache-Control: private, no-store. To cache Flx pages at your CDN instead, turn on edge caching (see the Description).

Which menus are supported?

The header menu, with custom, page, post and category links, and sub-menus up to three levels deep (they open on hover and keyboard focus).

Does it need WooCommerce?

No.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Flx Modernize” adalah perisian sumber terbuka. Orang-orang berikut telah menyumbang kepada pemalam ini.

Penyumbang

Translate “Flx Modernize” into your language.

Berminat dalam pembangunan?

Layari kod, periksa repositori SVN, atau langgani log pembangunan dengan RSS.

Changelog

1.6.0

  • Plugin stylesheets and inline styles from the page head and footer now reach Flx pages, and plugin scripts get the WordPress scripts they depend on (jQuery, wp-i18n, …), in WordPress’s order. Tested with Contact Form 7 and Easy FancyBox. WordPress’s block and theme styles stay out; the renderer provides them. Renderer package 1.6.0 keeps form fields in post content looking as on WordPress.

1.5.0

  • Post pages get the theme’s “Written by … in ” line, tags, previous/next post links and “More posts” list (author_url, categories, tags, previous, next, more_posts; renderer package 1.5.0 or later).

1.4.0

  • Comments on post pages: the theme’s comments section (approved comments and the reply form) is sent as WordPress renders it for an anonymous visitor (comments_html, renderer package 1.4.0 or later). Form plugins keep working. Visitors who have commented, and reply or “awaiting moderation” links, get normal WordPress. The filter flx_modernize_comments_html can change or remove the section.
  • Header sub-menus, up to three levels deep (renderer package 1.4.0 or later); they open on hover and keyboard focus.
  • Search results get the theme’s “More posts” list (more_posts, the four latest posts; renderer package 1.4.0 or later).
  • Edge caching also purges when a comment is approved on arrival or edited, and when comment settings change.

1.3.0

  • The site language is sent to the Render service (language, as in get_bloginfo( 'language' )), so Flx pages have the right <html lang> (renderer package 1.3.0 or later). Renderer package 1.3.0 also adds the “Skip to content” link.

1.2.0

  • Optional edge caching: with FLX_MODERNIZE_EDGE_TTL in wp-config.php, pages, posts, the blog home page and category and tag archives without a query string are sent public, max-age=0, s-maxage=<TTL> so a CDN can store them. Search, 404, query strings, fallback pages and logged-in users are never cached.
  • Optional Cloudflare purge after content, menu, settings or plugin changes (FLX_MODERNIZE_CLOUDFLARE_ZONE_ID, FLX_MODERNIZE_CLOUDFLARE_API_TOKEN).
  • Works with renderer package 1.2.0 (Tailwind CSS styling).

1.1.0

  • SEO tags, JSON-LD and plugin scripts from wp_head and wp_footer are sent to the Render service (head_html, footer_html), so SEO plugins such as Yoast work on Flx pages. Filter flx_modernize_head_footer_output turns it off.

1.0.0

  • New Flx Modernize: renders the blog home page, archives, posts, pages, search results and the 404 page through your Flx Render service, in the Twenty Twenty-Five theme’s look.
  • Serves anonymous visitors only; logged-in users, previews and password-protected or non-public content always get normal WordPress.
  • Page data is built as an anonymous visitor; no visitor data is sent except search words.
  • Optional signed requests to the Render service.
  • Cache-Control: private, no-store on Flx pages and no-store on fallback pages; DONOTCACHEPAGE for page-cache plugins.
  • Header menus with custom, page, post and category links.
  • flx_modernize_should_render filter to turn Flx off for a request.
  • No default Render URL: nothing is sent until an administrator saves one.

0.0.2

  • Early preview.