This is the last Blog of the year already and what a wonderful time has it been, so for the last time this year we are going to look at the package xStatic.
xStatic is a package that statically generates your Umbraco website and gives you the ability to deploy it in a myriad of ways, like AWS, Netlify, FTP or via Git. In my case, we are looking at deploying it via Netlify because it is easy and free.
Setup
Firstly, you will need to install the xStatic NuGet package. With this, you can build and deploy your site to a local folder. To add the other deployment options, you will need to add one of the other packages of xStatic. In my case, xStatic.Netlify.
After installing it, you will need to add "services.AddXStatic().Automatic().Build();" to your startup file. If you have added one of the other packages, there is a chance that it will not detect it correctly, and then you will also need to add an extra line of code. In Netlify's case, "builder.Services.AddNetlifyActions();".
Now just add the xStatic file in the App_Plugins to your project, and you are ready to start. After logging in, you will first need to set up the xStatic tab by adding it to the correct user role.
Now in the new tab, you will get the option to create a new site where you will need to fill in the root node from which it will generate. Additionally, you can configure the media files or folders you want to add, how to export the files in HTML or JSON, and the asset paths for all stylesheets or JavaScript files.
For deployment, you can set it up if it should auto-publish when a node is published and how it should be published. In my case, that also includes the access token and the site ID from Netlify.
After which you will see the site and get the option to build, deploy, or the option to download the code if you want to.
Uses and limitations
Now, what are the use cases and limits for this package?
By generating a static site, it will be a lot quicker to use than normal and you can save a on hosting costs. Additionally, by using this setup instead of just creating a static site yourself, you can always make the change to no longer use a static setup and use more of the functionality of Umbraco. You can more easily fill in the correct data and use it more globally, additionally it will be a lot easier to add more pages.
There are also some limitations by using this setup like limited use of some of the great Umbraco functionality like search or dynamically getting you data. Additionally, because you are only hosting the site and not the CMS this setup is more for developers even getting the data to be shared with other people will need extra work like hosting a SQL Server somewhere or using uSync.
Opinion
In my opinion, it is a nice way to set up a simple hobby site because you always stop when you have to think about hosting and how much it will cost. Otherwise, I don't see a use case for clients besides small one-off campaign sites.
Top comments (0)