Static site generators and Enonic XP
Enonic lets you manage content or enable dynamic services for your static sites.
Static site generators, or SSGs for short, have become popular the last few years due to delivering faster loading times, smoother user experiences, higher security, and improved scaling possibilities.
The popularity can also be ascribed to the website in question being less dependent on a content management system, and to the growth of new front-end frameworks which can make the user experience richer.
Enonic is a flexible content platform which can be used as a traditional CMS or a headless CMS for your web apps. Enonic naturally supports SSGs as well, and comes into the picture the moment you need content editors to manage content for a static website.
What Enonic can do with SSG
When your digital project needs content to be maintained by editors, interaction with the server, or maybe search functionality—Enonic can help solve your tasks. There are two main aspects Enonic can contribute to:
The first aspect relates to using the Enonic platform as a source when generating a static site, which you can read more about on our Developer Portal.
The second aspect relates to introducing dynamic behaviour, like search and listing of dynamic content, on a static site you have already built and deployed. For instance, when updating one item on an eCommerce site containing thousands of products, it is not preferable to crunch the whole site anew for every change. A site can have static landing pages for different product categories, while the “recommended products for you” box can be dynamic.
These instances are dependent on communicating with a server and a solution to retrieve the dynamic content, wherein Enonic can help you build the static part, serve the dynamic content, or be used for a combination of these two.
Static site generators work great for sites that rarely change or special performance requirements where CDNs and caching is insufficient. But disadvantages—like the time from publishing a change to a freshly generated site, as well as limited preview capabilities—should not be underestimated.
Enonic’s role is to address such weaknesses.
See also: Localise your content with Enonic »
With the correct setup in Enonic, you can in many instances get a preview of content before going live. As this is a considerable challenge in most SSGs to date, this can prove to be a very useful feature from Enonic.
But be aware that this is not an out of the box feature in Enonic—and must be handled with custom setup by developers.
As Enonic is a headless CMS, you can use this to get an SSG up and running quickly. With Enonic you get full flexibility: You can make a regular static site, or reuse content in hundreds of channels in a true omnichannel fashion.
Simply use the same API to both generate sites and feed live content. Enonic uses a powerful GraphQL API, and there is no limit to what SSGs, frameworks, or clients you can use in your project.
Read more: Content first: How Enonic works headlessly »
SSGs and Enonic in practice
While our customer NAV has built a static solution with Next.js, we have ourselves made forays into Gatsby.js. Read this guide on our Developer Portal and watch the following video to see how you can build static websites with Gatsby.js and Enonic XP: