Code

Static Site Generators an Option for Ecommerce Blogs, Content

Static site generators offer an alternative to content management systems like WordPress or similar and may produce faster-loading web pages that are more secure and less complex to maintain. Static site generators would not be the best choice for every site or application, but they are a valid option for content marketing and store blogs.

Content marketing is an important part of promoting an online retail business. Blog articles can attract, engage, and retain customers, helping merchants build relationships and make sales.

In fact, many retail ecommerce companies, from small start ups to massive enterprises, employ content marketing and have a store blog.

For almost all of these companies, a blog means having a dynamic content management system that dutifully stores content in a database and dynamically creates web pages whenever a user visits.

A store’s CMS may be incorporated into the retailer’s ecommerce platform — it could be an extension or add-on — or it may be a separate solution hosted on a different server.

A CMS will be the best option for some businesses, but it need not be the only option online retail marketers consider.

Static Site Generators: Key Features

Static site generators use modern tools like templates, pipelines and compliers, and Git version control to build static websites. Content like the copy in a blog post is not stored in a database, but kept in a simple text file.

Sites are generated wholesale and every visitor sees the identical version of the page until the entire site is regenerated.

This approach has some important benefits.

Good performance. Static web pages load faster than dynamic web pages. Static pages don’t wait for database queries to come back and are not built on demand. The difference in performance can be significant.

Simplicity and reliability. Static sites are simple. The generated site doesn’t need a server-side scripting language, won’t require a database, and doesn’t need a caching mechanism. There are far fewer dependencies and far fewer things that can go wrong. So a static site can be more reliable, and a simple static site can be less expensive to host, too.

Design flexibility. There are very few design limitations for static sites. Often CMS-based sites start with a bare bones theme that uses some of the content management system’s conventions. To a greater degree, static sites can be a clean slate.

Security. Without a database or server-side code to run, static sites are less vulnerable to cyber attacks.

Scalability. Simple, lightweight HTML files can be scaled to meet peak traffic demands.

Content version control. Modern web developers depend on version control systems like Git to maintain and backup code. Sites built with a static site generator use this same approach to maintain and back up content. If for some reason, a server failed and destroyed the production version of a site, everything could be rebuilt from the repository.

Why Haven’t We Used Static Sites Before?

Given a list of benefits like good performance, simplicity, and reliability, and more, why haven’t blogs or other websites always used static site generators?

The answer can be found in how the web has evolved.

Consider the early Internet. The very first web pages were completely static. A developer hand coded HTML for every page of a website. If code like headers, footers, or navigation was reused from another page, those elements were copied and pasted from one static HTML file to the next.

The Internet’s original web page was static. It had copy and links.

These early static sites had many problems, including three that are worth noting in this context.

  • Content was hard to create and maintain.
  • A lot of code was duplicated in separate files.
  • Sites were not interactive.

A few examples will help make the point.

If a marketer wanted to publish an article on one of these early websites, he’d either need to know how to write basic code or he would have to get a developer to mark up and publish the post for him. If he discovered a typographical error in the fifth paragraph, he had to call the developer to correct it.

Next, imagine a website with 1,000 pages. Each page contains the code for the site navigation. If you wanted to add a link to a new page, you might have to update 1,000 individual HTML files.

Finally, static sites worked well when folks were only reading a website, but as soon as you want them to interact with the site and have the site respond, you need a dynamic web page.

Fast forward through advances in server side scripting, JavaScript, and the mainstreaming of relational databases, such as MySQL, and content management systems now address problems like the ones described above.

A CMS with a what-you-see-is-what-you-get (WYSIWYG) content editor meant that writers could create and update content without knowing HTML.

Languages like PHP enable a CMS to reuse code, giving web developers a single place to maintain things like site navigation and made interaction possible, so visitors could submit information and see the result of that submission on screen.

Problems solved.

Content Management Systems Make Trade-offs

Modern CMSs are quite good. They provide a number of features. They tend to be easy to use, and they solve or address basic Internet problems, including how to create and maintain web pages and how to make websites more interactive.

To achieve these results, content management systems, like nearly every software solution, trade some features or capabilities for others. These trade-offs are often worthwhile in context, but it is still important to understand that they exist and to know there may be alternatives.

Web developer Eduardo Bouças described these trade-offs with a newspaper analogy.

Imagine you walk up to a newspaper stand on a street corner in a big city. This stand sells dynamic newspapers, so when you put your money on the counter, the attendant makes a call to the newspaper company.

Reporters at the newspaper company start calling their contacts to get the latest news. They type up articles and the production department lays out a custom, dynamic paper and prints it just for you. This paper is trucked back to the newsstand where you get it.

This would happen, hypothetically, every time someone buys a newspaper.

A little further down the road is a newspaper stand selling static newspapers. Early this morning the newspaper company printed the newspapers, including all of the news available when they printed it. The newspapers are delivered to the newsstand ready for sale.

When a customer buys a newspaper the attendant simply hands them one.

The dynamic newspaper, which represents a CMS, is certainly more up to date. But it is also much more complex. Dynamic, CMS-driven websites give up speed and simplicity to solve other problems like the ones described earlier.

For example, dynamic content is almost a requirement for WYSIWYG editors, which in turn make it easier to create and maintain content, but those same dynamic pages used in conjunction with a WYSIWYG editor will load relatively less quickly and need a database like MySQL and some scripting language, such as PHP or Ruby, to content to the database.

Static Site Generators for Ecommerce Blogs

Static site generators have been around for several years. But as the Internet and web development have evolved, they have become far more mainstream.

Google uses static site generators for some of its projects, for example, Web Fundamentals. Email service provider MailChimp uses a static site generator for its site. Event Netflix is known to use static site generators, too.

As more businesses use static site generators and as the development communities around these tools grow up, they can become an option for retail businesses that need better site performance or who have experienced problems with their CMS.

Jekyll is one of the most popular static site generators.

There are many static site generators you might select. Based on the number of stars each project has earned on GitHub, some of the most popular solutions include the following.

Static site generators don’t typically include any sort of administration interface or WYSIWYG editor. In fact, the primary interface is probably a command line tool. To address this weakness, several tools are available to help writers create content.

These tools may be as basic as a converter for Google Docs to Markdown, such as the Export as Markdown extension for Chrome, or a more complex solution like Siteleaf or CloudCannon.

Static site generators will continue to grow in popularity. They are a realistic option for ecommerce blogs and content marketing campaigns.

Armando Roggio
Armando Roggio
Bio


x