Share content using includes and snippets
Use includes and snippets to share content among multiple articles within a repo. At this time, includes and snippets work only within a repo.
- Includes are useful for inserting the entire contents of a file (everything after the first
#
heading) into a different file. Create .md files in thehelp > _includes
folder, and reference them from any article in the repo. - Snippets are useful for sharing smaller sections of text. Add these smaller snippets to the
markdown.md
file in thehelp > _includes
folder.
Creating includes
-
If necessary, create an
_includes
directory in thehelp
directory. -
Create a markdown file in the
_includes
directory with the content you want to share.In this source markdown file, any metadata and the H1 (
# Title
) is ignored. Everything after the H1 is included when referenced. -
On a blank line in the target article, add a reference to the source include file in this format:
{{$include /help/_includes/legal-blurb.md}}
-
Commit the content and preview it.
{{
or }}
characters in files that do not reference include files.Creating snippets
For sharing smaller sections of text, you can create a snippets.md file and reference the H2 anchors. Snippets cannot include headings. If you need to include headings in your shared text, use includes.
-
Create a
snippets.md
file in thehelp > _includes
directory. -
Create a dummy H1 title.
-
For each shared section, create a Heading 2 with an anchor to be used to reference the snippet. Example:
code language-none ## Premium note {#premium-note} <div class="extension note"> <div>NOTE</div> <div> This feature is available as part of the Target Premium solution. It is not available in Target Standard without a Target Premium license. </div> </div>
-
In the target article, add a reference to the snippets.md file in this format:
{{premium-note}}
-
Commit the content and preview it.
{{
or }}
characters in files that do not reference snippets.