Skip to main content

Layouts

Layouts are used to scaffold page templates. This is where you’ll put your page’s HTML structure, including the <html>, <head>, and <body> tags. Layout files should end in .hbs and can include HTML and Handlebars expressions . Avoid putting markdown in layout files, as it will not be converted to HTML by Doxicity.

Layouts should be placed in the layouts folder, which is called “layouts” by default. You can have as many layout files as you like, but the most common layout for your website should be called default.hbs.

Placing Content

To tell Doxicity where content goes, use the {{{$content}}} magic property as shown below. Note the triple brackets, which will render the content as HTML instead of escaped content.

<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Your Title Here</title>
  </head>
  <body>
    <main>
      {{{$content}}}
    </main>
  </body>
</html>

This will place the content from your pages in the <main> section of the layout.

Using Layouts

The default layout is the one that all pages will use unless your page has a layout field. If no layout is specified, Doxicity will look for default.hbs. If a default layout isn’t found, a basic HTML layout will be used instead.

Pages that include a layout field in their front matter will use the specified layout. If no layout is specified, Doxicity will look for default.hbs. For example, the following page will use a layout located at layouts/custom.hbs.

---
title: My Page Title
layout: custom
---

Markdown content goes here...