Forestry CMS Snippets Demo

Posted on November 25, 2019 - 1 Minute Read

Snippets in Forestry are pre-defined chunks of text that can be inserted into your content. Think of them like WordPress Shortcodes. In this tutorial I will show you how to create a reusable snippet to embed responsive iframes.

forestry snippets demo

0. Prerequisites

This tutorial assumes you have a site up and running on Forestry. I will be using Jekyll in this tutorial, but Forestry works with all major static site generators. Also note that the responsive embed works because of Bootstrap. I created a Jekyll Boostrap Starter Theme if you'd like to follow along.

1. Creating a Custom Snippet

  1. Create a .forestry/snippets directory.
  2. Create a file ending in .snippet in the .forestry/snippets directory.

    1. In this case, I created a file called iframe.snippet
<!-- iframe.snippet -->
<div class="embed-responsive embed-responsive-16by9">
  <iframe class="embed-responsive-item" src="" allowfullscreen></iframe>

Now this code will be available as snippet when using the content editor.

Categorized In:

Learn Ruby on Rails For Free

I created Rails Code Along to help teach you how to build, test, troubleshoot, and launch a REAL production Rails application. This course is free, and does not require you to sign up.

Learn Ruby on Rails For Free

Let's Connect