xStatic documentation
Install, deploy and extend xStatic, kept up to date with each release.
How to install xStatic 14 into an existing Umbraco site, configure a site and a deployment target, and use actions and plugins.
xStatic has been rebuilt for Umbraco 14. This guide covers installing it into an existing Umbraco site and getting your first static site generated and deployed.
In Visual Studio, open Manage NuGet Packages and search for xStatic. There are several packages:
After installing the main package, add the configuration line to Program.cs to register xStatic’s services with the default settings, along with its using statement. That’s all. Umbraco runs exactly as before.
There’s a new xStatic section, but it won’t appear until a user group has access. You can add it to the Administrators group by hand, but there’s a better way in xStatic 14: the secure user groups setting. Give it the email address of your admin user, and xStatic creates its user groups automatically and adds that user. Log in and the section is there.
This creates two groups, xStatic admin and xStatic normal user. Deployment targets and actions are admin only, because they often hold personal access tokens or passwords.
Give the site a name, pick the root node to export (the starter kit only has one), pick the media folders it uses and choose the HTML export type. If your site has styling, add the asset paths too; for the starter kit that’s the CSS and scripts folders. The target host name is only needed if you want absolute links rather than relative ones.
Press Generate and xStatic walks the Umbraco tree, writing a static HTML version of each page. The dashboard shows the size of the output, and Download gives you a zip. Inside, each page is a folder with an index.html, so paths work the same as before, and the CSS and scripts folders are included. That’s a static copy of an existing Umbraco site with no changes to the site itself.
To deploy somewhere useful, create a deployment target. I used the built-in file system deployer and pointed it at a local folder; imagine a network drive, or a folder IIS serves. Edit the site with the yellow brush icon, pick the target and save. Press Deploy and the folder fills with the generated files.
Serving that folder with a simple Node HTTP server shows the Umbraco site, but noticeably faster, since there’s no server side processing. The links and content all work.
Actions change the generated files after generation. A common use is a not found page, since hosts expect it in a particular place. I made a simple 404 page in Umbraco, created a file copy action to copy it to 404.html, selected the action on the site, then generated and deployed again. The page appears where the host expects it.
The Netlify, Git and FTP plugins I maintain each add a deployer and its settings. Install them from NuGet, matching the version of xStatic you have, and you shouldn’t need any code changes. If one isn’t picked up, add a using for its namespace (XStatic.Netlify, XStatic.Git or XStatic.FTP) to make sure it’s loaded.
Each deployer shows its own fields when you create a target. Plugins can also bring actions: the Netlify one includes a 404 action that puts your page where Netlify expects it, so you can swap it in for the generic one.
There’s more documentation on the xStatic page, including how to extend it. Give it a go, and enjoy cheaper, faster Umbraco sites.
Install, deploy and extend xStatic, kept up to date with each release.
The package page, with downloads, docs and guides.