Static Generator

Generate a static website serve by github pages, apaches with one command or via the admin.

Install

composer require pushword/static-generator

That's it ! If you have a custom installation (not used the default installer),you may have a look inside vendor/pushword/admin/install.php.

Configure

Add in your current config/packages/pushword.yaml for an App or globally under static_generator: in config/packages/static_generator.yaml.

# In pushword.yaml under your app config:
pushword:
  apps:
    - host: example.tld
      static_generators: [Pushword\StaticGenerator\Generator\PagesGenerator, ...]
      static_symlink: true
      static_dir: '%kernel.project_dir%/static/%main_host%'
      static_copy: ['assets', 'bundles'] # files/folders from public/ to copy

# Or globally in config/packages/static_generator.yaml:
static_generator:
  static_generators: apache # shortcuts: apache, github, frankenphp
  static_symlink: true
  static_dir: '%kernel.project_dir%/static/%main_host%'

The default generators are compatible with Apache/Litespeed and FrankenPHP/Caddy (generating .htaccess and Caddyfile).

Command

# Generate all apps
php bin/console pw:static

# Generate 1 app
php bin/console pw:static $host

# (re)Generate only one page
php bin/console pw:static $host $slug

Using FrankenPHP (Caddy) to serve your static website

You must import the generated static/example.tld/.Caddyfile in your main Caddyfile.

If you still use the default Caddyfile (from pushword/skeleton), see the last commented part :

import static/example.tld/.Caddyfile