FAQ / Including Files in Other Files

File inclusion is one of the core features of Bliptown. Markdown has no concept of layout, which makes it difficult to create interesting designs by translating Markdown to HTML alone. We overcome this by allowing any number of pages to be nested in other pages.

The syntax for this is {{ > path/to/page.md }} on its own line. Think of the “>” sign as like a little wedge to shove the file in. The path can be relative to the current page or absolute. The file extension is optional, but only Markdown files are supported.

n.b. Files beginning with _ (underscore) are ignored.

In foo.md you might have:

---
title: Foo Page
layout: one-column center
---

Nobis perferendis eius rerum sapiente doloremque. Sunt dolorum
excepturi ab consectetur sunt. Consectetur dolor maiores eos.

{{ > bar/baz }}

This uses a basic centred single-column layout and will be wrapped in the HTML <section class="one-column center">.

The included file bar/baz.md:

---
layout: gallery-grid
---

![image 1](/assets/image-1.jpg)

![image 2](/assets/image-2.jpg)

This will generate the Markdown:

---
title: Foo Page
layout: one-column center
---

Nobis perferendis eius rerum sapiente doloremque. Sunt dolorum
excepturi ab consectetur sunt. Consectetur dolor maiores eos.

<section class="gallery-grid">

![image 1](/assets/image-1.jpg)

![image 2](/assets/image-2.jpg)

</section>

The gallery-grid content will appear on “Foo Page” within the centered single-column layout. You can combine these multiple layers deep to get more interesting layouts. Think of it like Russian dolls.

Including Multiple Files

You can include multiple files in a page by using glob expressions. This allows you to create a blog page or collect similar pages in one spot.

To include multiple pages, create the containing page like any other, then add the inclusion tag to match the files you want to include, like so:

{{ > posts/* }}

Only pages that have a date metadata value will be included, so Bliptown knows how to sort them. The content of each page will render on the containing page in reverse chronological order.

← Previous | Source | Next →