adamziel / playground-docs-workflow

Experimenting with maintaining WordPress docs using WordPress Playground
https://adamziel.github.io/playground-docs-workflow/
11 stars 2 forks source link

Static site generation #48

Closed adamziel closed 4 months ago

adamziel commented 4 months ago

Supports rendering the documentation site as a set of static HTML, JS, CSS, etc files.

How does it work?

  1. The JavaScript crawler requests /logout/ to, well, log out.
  2. The /sitemap/ endpoint returns a list of all Posts with post_type=page and their URLs
  3. A JavaScript crawler requests each of those pages and writes the rendered HTML to the out directory
  4. All full-qualified site URLs are replaced with an absolute path
  5. The JavaScript crawler sends a request to /zip-wp-files/ to create wp.zip with wp-includes and wp-content inside (without PHP files)
  6. The JavaScript crawler unzips wp.zip in the out directory, shipping the missing static assets

Yeah, it's weird process – that's because of wp-now's limitations.

wp-now workarounds

I had to use a few workarounds that would be better addressed in wp-now:

These would all make good issues

cc @sejas @wojtekn