DEV Community

Chris Gray
Chris Gray

Posted on • Originally published at chrisgray.tech on

Static vs Dynamic Sites

Static vs Dynamic Sites

Way back when netscape was new and home internet was in it's infancy you really only had one option for a website which was hard-coding it using HTML and for year this was the standard, it made updating sites difficult, painful and often out of the reach of standard business owners. The years went on and eventually WordPress came out bringing site development to the general masses, with WordPress you could not only build and update your websites from a (at the time) easy to use interface, you could also implement a whole range of dynamic functionality like contact forms, community sites and eventually even eCommerce systems. With a wide range of functionality available it often seemed like the only limitation was your imagination for what could be done, all you'd need is a developer and a budget. With such a strong market position and range of functionality why are static sites now becoming a thing again?

What is a static site?

As outlined below a static site is usually just HTML, CSS and JS. Any content changes have to be done by manually modifying the HTML code. If you're not familiar with HTML this can be intimidating as one wrong modification can lead to your whole site looking completely wrong. So with all of this barrier to entry why would you bother versus just downloading a WordPress theme and making the tweaks you need to the style. Enter the Static Site Generator.

Static Site Generators

One of the first big Static Site Generators (SSGs) was Jekyll, Jekyll allowed you to get the best of both worlds, you could setup a number of templates for posts and pages, write the content using MarkDown in YML files, run a quick CLI tool and Jekyll would take care of the rest. This allowed you to have the fine-tuned control of a normal static site without the tedious process of creating a new HTML file everytime you wanted to create a new post. Since then the market has been flooded with tools and frameworks in just about every programming language you can think of.

Advantage of Static Sites

Performance

One of the big advantages of a static site vs a dynamic one is performance, as the site isn't having to do processor intensive queries of databases on every page load navigating around a static site is fast, really fast. With proper setup around file minification and image optimisation pages can load on a modern internet correction in the region of milliseconds. With Google putting more and more weight on site performance as a ranking tool this can have a huge benefit for both you and your business.

Flexibility

Take for a example a twitter feed, with say a WordPress site you'd likely need to install a plugin and use a shortcode to make it appear on the front-end, this introduces complexity, additional script loads and security issues all in one package. As you're editing an HTML file, implementing a twitter feed can be as simple as copying and pasting the recommended code from twitter or as complex as manually creating and styling a custom twitter feed. The only limit is your ability.

Improved reliability

As there is no back-end service or database providing content for your site there is no longer additional avialability requirements in order for your site to work. Sudden influxes of traffic will no longer cause performance issues and it will be more difficult for malicious users to bring the site down. It's not impossible and security and reliability is definitely something that should be took into account when planning and building your site but it is a lot more robust than most CMS and dynamic platforms.

Static vs Dynamic Sites

No more error establishing connection errors with static sites.

Simpler hosting requirements

When you host a dynamic site you tend to need to take into account a lot of different elements, for example:

  • Can my host handle DB hosting?
  • Will it run the WordPress software?
  • Is the setup optimised for loading dynamic files?

When hosting a static site your requirements become much simpler:

  • Can I host HTML files?
  • Does the platform use NGINX or Apache?

Whilst there can be other requirements dependant on your deployment plan these are the two base requirements for any static site, massively simplifying your hosting and often saving a lot of money in additional software and support costs.

Downside of Static Sites

With all of the above I'm sure many of you are wondering what's the downside? Well there's a handful.

Complexity

Even with systems like Jekyll you still need to create the original layout and unlike a lot of modern WordPress themes Jekyll doesn't come with a fancy drag n' drop site designer. You need to create is using HTML, CSS and JS. This can result in you needing to bring in someone external to do the initial setup resulting in unforseen costs. Also creating new posts can be tricky, your tool for content is often just a standard text editor, whilst this can help to simplify things, dependant on the SSG you use it can also complicate things if you need to learn Markdown. There are Web UIs out there like Netlify, PrismicIO and Contentful but in my experience integrating with these has a long way to come in terms of documentation and support before I'd recommend them.

Functionality

If you need a massive eCommerce platform with auto-marketing functionality and membership areas then a static site is not going to work for you. As the site consists purely of HTML/CSS/JS files anything more complex than a contact form or a twitter feed is not going to be possible and a dynamic site or CMS platform like WordPress is going to be infinitely more suitable.

Which is better?

As you can see above both CMS/Dynamic Sites and Static Sites have their place on the web and the decision really comes down to the following:

  • Budget
  • Project requirements/complexity
  • Your skills and abilities
  • Your userbase

If you need a fast site that's seven pages and advertises an event with a contact form then by all means go the SSG route, you'll see a much greater return on ROI even if you have to hire an external developer to get started. If you need a full range membership site, with e-learning and a shop then a CMS based website is going to be a much better route to go.

Latest comments (0)