Beginner's Guide to Content Management Systems and Templating Engines
Tags: cms, webdev, tutorial, seo
Published: 2020-02-25 17:04:02

If you're new to web development—especially if you are coming from adjacent territory like marketing or product management, you've probably begun to understand the basics of variables and for loops but there's a big gap between where you are and how things get done in the wild. The goal of this post is to introduce you to the wild world of content management and tame it at the same time. Hope you enjoy!

## Redefining the Content Management System Category

The term “Content Management System” describes an actively expanding category of software that can be used to manage the creation and modification of digital content. You may think that definition seems broad but that’s because the category is really broad! In fact, **[Wikipedia](https://en.wikipedia.org/wiki/Content_management_system) doesn't even include serving content as a requirement for this definition!

On top of the content creation-and-modification functionality, most CMS’s provide a much wider range of offerings. This starts, of course, with actually serving the content as HTML pages (rather than just text or image files) and includes common services like handling ecommerce transactions, managing user credentials and web analytics. 

Here are a few members of the Venn diagram that is the CMS category:

*   **[Wordpress](https://wordpress.com/)**: The **most popular CMS** started as a blog platform but now is capable of supporting any type of app from ecommerce shops to user-review websites.
*   **[Shopify](https://www.shopify.com/)**: The **popular** **ecommerce platform** is essentially a CMS that focuses on managing product content and handling monetary transactions.
*   **[Dropbox](https://www.dropbox.com/):** You might not consider the **digital asset management software **a CMS, the app allows you to upload images and serve them publicly on the web.
*   **[Hubspot](https://www.hubspot.com/):** The **customer relationship management (CRM)** system, also offers a blog and landing page CMS with the personalization benefits that only a CRM could. 
*   **[Ghost]( https://ghost.org/)**: One of the most popular in a category of “**headless CMS**,” Ghost serves content via an API which is perfect Javascript-based single-page apps (SPAs).
*   **[Webflow](https://webflow.com/)**: A **codeless CMS**, it affords 80% of the content and design capabilities of a code-based CMS like Wordpress, without needing to write custom code to use them.
*   **[Pelican](https://blog.getpelican.com/):** On the far corner of the CMS world is this **static site generator** written in Python. Pelican simply translates a collection of text files ([Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) is commonly used) into a website that can be hosted on services like.

From headless to full-stack, codeless to code-only, feature-rich to barely-a-CMS, you get the idea: the space is huge. 

There is a CMS for almost any use case: If you don’t want to use a database, use a static site generator like Pelican or Jekyll. If you want to build a front end but don’t want to worry about the back end, use a headless CMS. If you want to use a CMS with a ton of community support and familiar developers, use Wordpress. The list goes on.

No matter your use case, there are some general principles that apply to most CMS that are good to understand. That’s what we’ll get into next.


## Beyond Content: Themes and Templates

If you are working on SEO but aren’t really familiar with web development, you might have heard some of these terms like “theme,” “templating,” and “rendering,” and wonder what they’re all about. Let’s fix that.


### CMS Themes

Most CMS, including Wordpress, Drupal, and Shopify employ a concept of themes (even if they call them something else). Themes are the CSS, Javascript, and HTML template files that package CMS content into a complete website experience.

The combination of these files in a browser creates the _“look-and-feel”_ of a website: CSS files define visual characteristics like background colors, typography, and iconography while JS files create animations and interactivity. HTML templates determine the layout of the content on a page whether that’s in a phone, tablet, or computer screen.

**Themes offer one massive benefit: [separation of concerns](https://en.wikipedia.org/wiki/Separation_of_concerns). **This means that the _content_ is separated from the _presentation_ of the content. And while you might take that for granted, this is what makes it so easy to modify the layout of all the pages on a site without having to change the HTML of each page. (This was a game-changer in the early Web 2.0 days!) 

For example, if you want to change a Wordpress theme or Pelican theme, all you have to do is add the theme files to your project and change some site settings and voilà, your site has a hot new look!


### HTML Templating

At the core of every theme is the way that content is transformed and merged into HTML to create a webpage. This is called templating. Typically template files look like regular HTML files except, instead of containing the page’s content within the HTML tags, there are variable placeholders and other “templating logic”  that will be replaced with the page’s content when the page is “rendered” by the CMS code.


![How templating engines work](https://dev-to-uploads.s3.amazonaws.com/i/zz0jsrhxczztark0myov.png)

It really helps to see an example. Below is a very minimal HTML page with variables (denoted by the `{{variable}}` syntax) embedded in the HTML.


{% gist https://gist.github.com/trevorfox/529c40da01f66be0f6c72b2a50a9e5ae file=jinja2-variable-example-raw.html%}


After the variables are replaced with the page’s content, the output HTML file would look something like this: 

{% gist https://gist.github.com/trevorfox/529c40da01f66be0f6c72b2a50a9e5ae file=jinja2-variable-example-rendered.html%}


Let’s step way back for a moment and discuss what this all means. Consider how much easier it is to scale up a website with a lot of content. Without templating, the best way to create new pages would be to copy a similar existing HTML file and replace the copied page’s with new content. It sounds like a nightmare! And what if you wanted to change something about a page you copied from?? Yeah… you get the idea.

This generic approach to generating HTML files was a game-changer. Now nearly every single site on the web employs the concept of templating and it’s a foundational piece of SEO.

Let’s consider the popular marketplace website, craigslist.com. The site has millions (billions?) of live pages at any moment but it likely has fewer than 100 different templates. There are pages for every geographic locale that list all the categories for that locale, there are several types of category pages that list all the event, service, and for-sale item listing in that locale, and there are pages with all the details for each event, service, or item in that category. The pages add up quickly, but thanks to templates, the site’s content scales beautifully. 

This is a great example for SEO too. Consider for a moment that all of Craigslist’s category pages are just templates with content from other pages combined dynamically to generate content for these new pages. It’s like every time they have content for a few listing pages they get a category page for free—and all the organic traffic that comes with it.


### Templating Engines

Most CMSs employ a templating engine (or you might hear them called  “templating languages”) on top of whatever programming language the CMS was built on. templating engines make it easy to render HTML files from template files. Here are a few examples and the CMS’ and web frameworks that use them.


*   **[Liquid](https://shopify.github.io/liquid/)**: Ruby’s most popular templating engine is used by Shopify, [Jekyll](https://jekyllrb.com/), [Zendesk](https://support.zendesk.com/hc/en-us/articles/203662116-Using-placeholders), and many [others](https://github.com/Shopify/liquid/wiki#who-uses-liquid)
*   **[Jinja2](http://jinja.pocoo.org/)**: Python’s most popular templating engine is used by Pelican and can be used with the web frameworks [Flask](https://palletsprojects.com/p/flask/) and [Django](https://www.djangoproject.com/) and [others](https://stackshare.io/jinja2)
*   **[HubL](https://designers.hubspot.com/docs/hubl/syntax)**: Hubspot’s proprietary templating engine for web and email is an extension of on Jinja offering more Hubspot-specific functionality
*   **[Handlebars](https://handlebarsjs.com/)**: The Javascript templating engine is used by Ghost, [Enduro.js](https://stackshare.io/jinja2) CMS, and web frameworks such as Ember.js and Metor.js.
*   **[PHP](https://css-tricks.com/php-templating-in-just-php/)?**: Ok, PHP is a scripting language but it’s still worth mentioning here because the language was built for constructing web pages. As part of the language’s design, you [write logic into .php files](https://www.sitepoint.com/create-your-own-wordpress-theme-from-an-html-template/) that output content into the HTML.

This is only a small sample of templating engines. Most popular programming languages have several popular options but all of these templating engines have a few things in common: they assemble and render HTML files from templates that look like HTML but can contain variables, conditional logic, and other inserted or inherited templates. 

In the future, I _hope_ to break down how website templating works, especially within the [context of SEO](https://trevorfox.com/2018/10/seo-measurement-framework/). 

{% twitter 1232197587630989313 %}

But for now, this is the end of this primer on content management systems, themes, and templates. Hopefully, this sets the foundation for future posts about hands-on technical SEO with the static-site generator, Pelican as code examples.