Upgrading xStatic to work on Umbraco 9 wasn't just a case of updating some NuGet packages... here's what's new.
You can now install xStatic via NuGet, or more accurately you must! As part of this the plugins have been separated so you only need to install what you want.
This is the package to install the static site generation functionality into your Umbraco website.
This is the package to reference if you want to build your own deployers, transformers, generators etc. It contains a lot of the logic and interface classes used by the plugin.
All other packages that start with xStatic are plugins; these will add certain functionality into your xStatic installation. Examples of this are xStatic.Netlify, xStatic.Git, and xStatic.Ftp.
In v1 of xStatic you didn't have to write a single line of code in order to start generating static versions of your Umbraco sites. This is no longer the case.
In order to get xStatic working in Umbraco 9 and still follow .Net 5 best practice you'll now have open an IDE. Don't fret though, it is only one single line in your Startup.cs file.
This line installs all the required services and automatically discovers what plugin components have been installed.
This allows coders to override the default classes with their own instances if required.
The xStatic plugin no longer relies on any other Umbraco packages. This means that it can now be used by gold partners and on Umbraco Cloud without any restrictions.
In v1, customisation of xStatic required the editing of a JSON file; if this JSON file was changed and xStatic was upgraded this would be overwritten which was a nuisance.
This file no longer exists and has been replaced with more standard C# code or user friendly dashboards.
Export types are the components that control how a static site will be generated when the build button is pressed. Previously these could only be changed by editing the config file, but this has now been replaced by a database table and editing interface inside Umbraco.
This makes it much easier to create your own generators as well as being able to make make changes without a code deployment.
A new feature added in the v2 release are 'Actions'. These are components that can be configured to run some extra processing once the site generation has completed. Built into the core package are actions for renaming, copying, or deleting files; the Netlify package has a specific action for creating the 404 page.
It is really easy to create your own actions, simply implement the IPostGenerationAction interface's single RunAction method.
These actions can specify a configuration model that will allow editors to configure them in the CMS. This allows you to run similar actions multiple times on a single site or reuse actions on multisite.
Actions are perfect for final file alterations, generating sitemaps, sending notifications, and hopefully many more examples that I haven't listed here.
Now that the packages are separated, a new section has been added to help with working out what components are installed.