Docs » Pages, templates and URLs

Webhook uses the Swig JS templating language. It is very similar to Django, Jinja and Twig. Beyond that, we add some Webhook specific template rules and filters.

Your Webhook site's HTML is split into two folders: pages and templates. Below is the directory structure and HTML file for a basic blog.

Pages

The pages folder holds HTML files which you need to turn into fully formed URLs. For example

Also, if you happen to create any single item types in the CMS, we'll automatically create a your_type_name.html page for you in there.

Templates

The templates directory holds two types of html files:

  • Partial includes you wish use in your site like /templates/partials/header.html.
  • Templates that match the content-types in your CMS. For example /templates/videogames/.

The second type are normally built from the CMS through scaffolding. By default we create two templates for every new content type.

Sub-templates

You can also add more templates into your content-type folders to build more than just the individual.html index page. For example, let's say you want to add a screenshots sub-page to each videogame. To do so you could simply add a new template to templates/videogames/screenshots.html. This page would render for every videogame at yoursite.com/videogames/specific-game-name/screenshots/.

Custom and vanity URL patterns

For multi-item content-types Webhook allows the ability to further customize the URL structure of your site. In the CMS itself you can dictate the following URL patterns.

  • Where the list view of that content-type resolves. /videogames/
  • The default URL pattern for the items within that content type. /videogames/item-name/
  • Lastly, you can give a pure vanity name to each individual item name. /halo/

The URL patterns you can type into these forms allow the use of variables. Below is a list of acceptable patterns.

URL option Example Description
# none Don't use a prefix url for individual items. Your list.html will still render at /content-type-name/.
#Y 2014 The full publish date year.
#y 14 The publish date year, last two digits.
#m 02 The publish date month number, leading zero.
#n 2 The publish date month number, no leading zero.
#F february The publish date month name full (january, october, etc).
#M feb The publish date month short name (jan, oct, etc).
#d 03 The publish date day leading zero.
#j 3 The publish date day, no leading zero.
#T videogames The content-type name (e.g. Video Games).