⏱ 4 min read

What's New in 3.4

StaticForge 3.4.0 adds site-wide feeds, a dev server that rebuilds and reloads for you, a proper 404 page, and safeguards that stop a bad deploy from wiping your site. Everything new is opt-in or only changes something that was already broken. Various bug and security fixes are included as well.


Site-wide feeds

StaticForge has always written one RSS feed per category. 3.4 can also write a feed for the whole site, in three formats:

Format Address
RSS 2.0 /feed.xml
Atom 1.0 /feed.atom
JSON Feed 1.1 /feed.json

Your category feeds are not touched. Same address, same content, so podcast feeds keep working exactly as before. Categories can also get Atom and JSON versions alongside their rss.xml, if you ask for them.

Turn the site feeds on in siteconfig.yaml:

feed:
  enabled: true

They are off by default for existing sites, and on for sites created with site:init. Drafts, noindex pages, the 404 page and generated pages are left out. So is any category whose definition file has podcast: true, because the site feeds cannot carry podcast enclosures. The bundled themes add the autodiscovery <link> tags for you, and custom themes get a feed_links variable. See RSS Feed for every option.


Dev server with live reload

site:devserver --watch watches your content, templates and configuration. When you save a file it rebuilds and reloads the open browser tab.

lando php bin/staticforge.php site:devserver --watch

Set SITE_BASE_URL in .env to the dev server address (for example http://localhost:8000/) while you work, so your CSS and JavaScript load from it. See Dev Server and Live Reload.


A 404 page

The staticforce and sample themes now include a 404 template. Create content/404.md with template: 404 and StaticForge builds public/404.html. It has a search box (in staticforce) and a list of popular sections you can set with 404_links in siteconfig.yaml.

See 404 Pages.


Safer deploys

site:upload has a new safety net:

See Deploy Safety.


Smaller improvements


Upgrading

  1. Update StaticForge and run site:render. Nothing else is required.
  2. To use site feeds, add feed: with enabled: true to siteconfig.yaml. If you publish a podcast, put podcast: true in the category's definition file so its episodes stay out of the site feeds.
  3. To add a 404 page, create content/404.md (see 404 Pages) and run make:htaccess to get the Apache line.
  4. audit:live now makes two extra requests to check for a real 404. A site that answers 200 or redirects for a missing page will fail that check.
  5. If you rely on a symbolic link inside public/ while using the dev server, copy the files instead. Links that point outside the output folder now return 404.

Coming later

Two things are planned for 3.5: moving to PHP's newer built-in HTML parser, and an atomic deploy mode that switches to the new version of your site in one step.