Book Image

Getting Started with Ghost

Book Image

Getting Started with Ghost

Overview of this book

Table of Contents (13 chapters)

Handlebars' logicless templating


The use of Handlebars.js is at the core of how Ghost themes operate. Handlebars is what is known as a "logic-less" templating language, which in a nutshell means its job is simply to display blog-specific content.

When creating themes for Ghost, it is important to understand that the platform keeps a very clear delineation between design, which is the area themes are responsible for, and functionality, which is the area Ghost itself and apps are responsible for. The logic-less nature of Handlebars helps to ensure that Ghost themes don't step outside the role for which they are intended, and that is controlling the presentation of a blog.

Unlike PHP-driven templating systems, Ghost's Handlebars-driven template files don't handle any manipulation of data, custom database queries, or any other processes driven by logic. In a Ghost theme, you can't write functions, create variables, or evaluate conditions outside of checking whether or not there is content available...