humanmade/Static-Page

Name: Static-Page

Owner: Human Made

Description: Static Page offloading

Created: 2016-12-06 01:54:58.0

Updated: 2017-10-23 09:34:52.0

Pushed: 2017-09-21 16:29:00.0

Homepage: null

Size: 38

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Static Page Generator for WordPress

Export / save static copies of all your WordPress URLs.

This plugin is very specific in what it offers, that is - saving (almost) all URLs that can be publicly viewed on a WordPress site to another directory. This can be used in conjunction with different Stream Wrappers to upload to locations on S3, FTP etc.

The plugin essentials works like so:

  1. Get all the URLs that exist on the site via get_posts, get_terms etc etc.
  2. Generate the public markup from each URL.
  3. Perform any replacements on the content such as transforming URLs.
  4. Save the pages to a directory, preserving the original path.

This can be triggered via WP CLI Commands, or via cron when content on the WordPress site is updated.

WP CLI Commands

Get the output of a single page, for testing

tatic-page output http://wordpress.dev/ [--replace-from=<from>] [--replace-to=<to>]

List all URLs that Static Page knows about

tatic-page urls

Save the site to static files

tatic-page save [--replace-from=<from>] [--replace-to=<to>]

List all assets that Static Page knows about

tatic-page assets

Save all assets out

tatic-page save-assets
Configuration

Static Page is meant to be require little configuration, in the case than you do need to configure this, you can use the following hooks:

Add / remove URLs that are generated

filter( 'static_page_site_urls', function ( $urls ) {
$urls[] = site_url( '/my-hidden-url/' );
return $urls;

Make custom URL replacements on the contents of pages

filter( 'static_page_replace_urls_in_content', function ( $page_markup ) {
return str_replace( site_url(), 'https://my-cdn.example.com/', $page_markup );

Add / remove assets directories to be copied on save-assets

All files of type jpg, css, js, png, gif will be copied from the directories.

filter( 'static_page_assets_dirs', function ( $dirs ) {
$dirs[] = plugin_dir( 'akismet' );
return $dirs;


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.