You can reuse content from files in the `_includes` folder.
Page Contents

About content reuse

You can embed content from one file inside another using includes. Put the file containing content you want to reuse (e.g., mypage.html) inside the _includes/custom folder and then use a tag like this:

{% include custom/mypage.html %}

With content in your _includesfolder, you don’t add any frontmatter to these pages because they will be included on other pages already containing frontmatter.

When you include a file, all of the file’s contents get included. You can’t specify that you only want a specific part of the file included. However, you can use parameters with includes. See the following Jekyll cast for more info about using parameters with includes:

Relative includes

In addition to using the {% include .. %} directive, Jekyll has an {% include_relative .. %} directive that enables you to specify a relative path for the content, instead of keeping it on the _include directory. This is enables you to have included/reused content that is specific to a particular release. For example, see the files in pages/en/lb3/includes.

Page-level variables

You can also create custom variables in your frontmatter like this:

---
title: Page-level variables
permalink: /doc/en/contrib/page_level_variables/
thing1: Joe
thing2: Dave
---

You can then access the values in those custom variables using the page namespace, like this:

thing1: {{page.thing1}}
thing2: {{page.thing2}}

I use includes all the time. Most of the includes in the _includes directory are pulled into the theme layouts. For those includes that change, I put them inside custom and then inside a specific project folder.

Tags: contributing