The basic Publii installation package comes with multiple themes built-in, but in order to limit the size of the output website the theme files are not added to each individual website until they are explicitly installed via the Publii interface. In this short guide we'll cover installing, uninstalling and updating these themes. as well as installing themes that are not included in the core Publii package, such as the Starter developer theme or other third-party themes.
Installing a Publii Theme
As mentioned above, when you install Publii to your local computer you are also installing all of the included themes. However, to use them on one of your Publii sites you will need to 'install' it for that particular site.
- Open your website in Publii, then click on the Settings option in the left-sidebar to go to the Site Settings page.
- In the Theme option you will see a No theme selected message; click on the drop-down list to see all of your available themes.
- In the list you will see all the themes currently installed in Publii under the Install and Use heading; select your preferred theme from this section then click the Save settings button. The chosen theme's files will be copied from the main Publii installation to your site's files, and the theme settings applied.
Your theme is now all set-up, so you can get started with building your content!
Changing to a different theme
Swapping to a new theme after you get bored with your current one is super-easy; just open the Site Settings screen again and choose your new theme from the Install and Use section. If you've already switched between multiple themes on your current site you'll notice that all your previously-installed themes appear under a separate Use heading; this allows for quick switching between installed themes without the need to copy the files across again.
Updating your theme
With new features and theme updates being added to Publii regularly, it's important to make sure that you are always using the latest version of your theme on your site to ensure compatibility.
New versions of each theme will be included with the Publii update package, so there's no need for additional downloads. However, you will need to get Publii to copy the updated theme files over to your site folder.To do so, open the Site Settings page as before and click on the Theme drop-down list. Your currently-installed themes and their version numbers will appear in the Use section of the list, while updated versions will appear in the Install and Use section. Click on your theme name in the Install and Use section, then press the Save settings button. The updated theme files will be copied over, ready for your site to use.
Uninstalling a theme
If you've switched between multiple themes on your site, each theme's files will be included in the website files that are generated when you sync with your server, potentially bloating the website's total size slightly. To combat this you can uninstall any themes from your site that you are not using; the files will still be available in Publii, they simply won't be included in your site's files.
To uninstall a theme, in the Site Settings → Theme section, open the drop-down list. Underneath the Use and Install and Use sections you'll see a third Uninstall section, which displays all your currently-installed themes. Click on the theme you wish to uninstall, then hit the Save settings button to remove it from your site files.
Installing an external theme
In some cases you may want to install a theme that is not included with the main Publii package; for example, the Publii team created the Starter theme that is mainly aimed at web developers who want to build their own theme and may be downloaded from the Publii theme marketplace. In such cases some small additional steps are required to add the theme to Publii:
- Download the theme package that you wish to add to Publii; in this example we'll download the starter.zip package downloaded from the marketplace.
- Once the download is complete, open Publii and navigate to the Global Settings by clicking on the three dots in the top-right of the Publii interface to open the submenu, then clicking the Settings option.
- On the Global Settings screen, scroll down to the third block of options that is titled Available themes; here all themes currently available in your local version of Publii will be displayed.
- Drag and drop the downloaded .zip package onto the Available themes section; Publii will automatically unpack and add the downloaded theme to its library.
- At this point you can follow the standard steps to install the new theme on your website; the Theme drop-down list will automatically include the newly-added theme in the list of themes available to install and use.