<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reuse content on Grafana Labs</title><link>https://grafana.com/docs/writers-toolkit/write/reuse-content/</link><description>Recent content in Reuse content on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 11 Jul 2023 10:24:20 -0400</lastBuildDate><atom:link href="/docs/writers-toolkit/write/reuse-content/index.xml" rel="self" type="application/rss+xml"/><item><title>Reuse directories of content with Hugo mounts</title><link>https://grafana.com/docs/writers-toolkit/write/reuse-content/reuse-directories/</link><pubDate>Wed, 29 Mar 2023 09:30:24 +0100</pubDate><guid>https://grafana.com/docs/writers-toolkit/write/reuse-content/reuse-directories/</guid><content><![CDATA[&lt;h1 id=&#34;reuse-directories-of-content-with-hugo-mounts&#34;&gt;Reuse directories of content with Hugo mounts&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Only a Grafana Labs employee can perform the following task.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Before Hugo performs a build, it reads the &lt;a href=&#34;https://gohugo.io/hugo-modules/configuration/#module-configuration-mounts&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;em&gt;Hugo module mounts&lt;/em&gt;&lt;/a&gt; configuration to construct a virtual filesystem.
Each mount mounts a source directory at a destination directory within that filesystem.
You can use Hugo mounts to reuse a whole directory of content in another part of the published technical documentation.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Identify a directory of content that you want to reuse.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Identify any pages to exclude.
Typically, excluded pages are ones that don&amp;rsquo;t make sense in the context of the target directory.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;p&gt;Pages in the directory might have relative links to other pages that would be broken by their exclusion.&lt;/p&gt;
&lt;p&gt;If the excluded page is replaced by another in the target directory, relative links continue to work.&lt;/p&gt;
&lt;p&gt;Otherwise, you should make the links absolute so that they always refer to the page in the source directory.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;steps&#34;&gt;Steps&lt;/h2&gt;
&lt;p&gt;To reuse a shared directory:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Determine the source and target directories.&lt;/p&gt;
&lt;p&gt;The source directory is the path to a directory in the &lt;code&gt;website&lt;/code&gt; repository.
It always has the path prefix &lt;code&gt;content/docs/&lt;/code&gt;.
The source directory for all Grafana Cloud content at the URL &lt;a href=&#34;/docs/grafana-cloud/&#34;&gt;https://grafana.com/docs/grafana-cloud/&lt;/a&gt; is &lt;code&gt;content/docs/grafana-cloud&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Similarly, the target directory has the path prefix &lt;code&gt;content/docs&lt;/code&gt;.
For the destination URL &lt;code&gt;https://grafana.com/docs/target-directory/&lt;/code&gt;, the path is &lt;code&gt;content/docs/target-directory&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;For every page in the source directory, set the canonical URL using the &lt;code&gt;canonical&lt;/code&gt; front matter, to the published open source page URL.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;canonical&lt;/code&gt; front matter indicates the preferred URL for duplicate or very similar pages.
For more information, refer to &lt;a href=&#34;/docs/writers-toolkit/write/front-matter/#canonical&#34;&gt;Canonical&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Update the website repository Hugo configuration.&lt;/p&gt;
&lt;p&gt;The configuration is in the &lt;code&gt;website&lt;/code&gt; repository in the &lt;code&gt;config/_default/params.yaml&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;Append the mount to the &lt;code&gt;manual_mounts&lt;/code&gt; key in the YAML configuration.&lt;/p&gt;
&lt;p&gt;For example, mount the source &lt;code&gt;content/docs/source-directory&lt;/code&gt; at &lt;code&gt;content/docs/target-directory&lt;/code&gt; and exclude the &lt;code&gt;content/docs/source-directory/_index.md&lt;/code&gt; file:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;- source: content/docs/source-directory
  target: content/docs/target-directory
  excludeFiles:
    - /_index.md&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="reuse-directories-of-content-with-hugo-mounts">Reuse directories of content with Hugo mounts&lt;/h1>
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>Only a Grafana Labs employee can perform the following task.&lt;/p>&lt;/blockquote>&lt;/div>
&lt;p>Before Hugo performs a build, it reads the &lt;a href="https://gohugo.io/hugo-modules/configuration/#module-configuration-mounts" target="_blank" rel="noopener noreferrer">&lt;em>Hugo module mounts&lt;/em>&lt;/a> configuration to construct a virtual filesystem.
Each mount mounts a source directory at a destination directory within that filesystem.
You can use Hugo mounts to reuse a whole directory of content in another part of the published technical documentation.&lt;/p></description></item><item><title>Reuse shared content</title><link>https://grafana.com/docs/writers-toolkit/write/reuse-content/reuse-shared-content/</link><pubDate>Wed, 22 Feb 2023 16:13:40 +0000</pubDate><guid>https://grafana.com/docs/writers-toolkit/write/reuse-content/reuse-shared-content/</guid><content><![CDATA[&lt;h1 id=&#34;reuse-shared-content&#34;&gt;Reuse shared content&lt;/h1&gt;
&lt;p&gt;Shared content is a sentence, paragraph, or page that makes sense in multiple contexts.
Reusing shared content propagates changes from a single source file to one or more destination pages.&lt;/p&gt;
&lt;p&gt;This topic describes how to extract and share a chunk of content to multiple pages.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Identify a chunk of content that you want to reuse in multiple pages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;steps&#34;&gt;Steps&lt;/h2&gt;
&lt;p&gt;To reuse shared content, follow these steps:&lt;/p&gt;
&lt;h3 id=&#34;create-a-shared-directory&#34;&gt;Create a shared directory&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Identify the sharing and consuming projects.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;When sharing content within a single project, that project is both the sharing and consuming project.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;However, when sharing content from one project to another then you must choose which is the sharing project and which is the consuming project.
Because Grafana Labs values external contributions, prefer to share from an open source projects.
For example, when sharing content between Tempo and Grafana Enterprise Traces, prefer Tempo to be the sharing project and Grafana Enterprise Traces to be the consuming project.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the sharing project, create the &lt;code&gt;docs/sources/shared/&lt;/code&gt; directory if it doesn&amp;rsquo;t exist.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the sharing project, create the file &lt;code&gt;docs/sources/shared/index.md&lt;/code&gt; if it doesn&amp;rsquo;t exist, with the following contents:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Markdown&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-markdown&#34;&gt;---
headless: true
---&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;index.md&lt;/code&gt; file tells Hugo that the &lt;code&gt;docs/sources/shared&lt;/code&gt; directory is a leaf bundle which is necessary for the &lt;code&gt;docs/shared&lt;/code&gt; shortcode to access files stored within.
For more information about leaf bundles, refer to &lt;a href=&#34;/docs/writers-toolkit/structure/#pages-and-page-bundles&#34;&gt;Pages and page bundles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After performing the preceding instructions for the first time in a repository, the directory structure looks similar to the following:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;console&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-console&#34;&gt;docs/sources/shared
└── index.md&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;create-a-shared-file&#34;&gt;Create a shared file&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the sharing project, create a file for the shared content in the &lt;code&gt;docs/sources/shared/&lt;/code&gt; directory.&lt;/p&gt;
&lt;p&gt;Name the file to reflect its contents.&lt;/p&gt;
&lt;p&gt;The file can be in a subdirectory, but that subdirectory must be in the &lt;code&gt;docs/sources/shared/&lt;/code&gt; directory.
The &lt;code&gt;docs/shared&lt;/code&gt; shortcode can&amp;rsquo;t look up files outside of this directory.&lt;/p&gt;
&lt;p&gt;The file&amp;rsquo;s contents should be the chunk of writing you want to reuse and a front matter section with a title.
You can include the labels in the front matter if you think it would be helpful information, but the labels won&amp;rsquo;t be visible in the consuming project:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Markdown&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-markdown&#34;&gt;---
labels:
  products:
    - cloud
    - oss
title: A shared file
---&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the consuming project, use the &lt;code&gt;docs/shared&lt;/code&gt; shortcode to include the shared content.&lt;/p&gt;
&lt;p&gt;To consume the file &lt;code&gt;docs/sources/shared/common-introduction.md&lt;/code&gt; from the latest version of the &lt;code&gt;tempo&lt;/code&gt; project documentation, the shortcode would be the following:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Markdown&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-markdown&#34;&gt;{{&amp;lt; docs/shared source=&amp;#34;tempo&amp;#34; lookup=&amp;#34;common-introduction.md&amp;#34; version=&amp;#34;latest&amp;#34; &amp;gt;}}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For more information about the &lt;code&gt;docs/shared&lt;/code&gt; shortcode parameters, refer to the &lt;a href=&#34;/docs/writers-toolkit/write/shortcodes/#docsshared&#34;&gt;&lt;code&gt;docs/shared&lt;/code&gt; shortcode&lt;/a&gt; reference.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Verify the include.&lt;/p&gt;
&lt;p&gt;To review the changes to the documentation, refer to the steps in &lt;a href=&#34;/docs/writers-toolkit/contribute/#review-your-changes&#34;&gt;Review your changes&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="reuse-shared-content">Reuse shared content&lt;/h1>
&lt;p>Shared content is a sentence, paragraph, or page that makes sense in multiple contexts.
Reusing shared content propagates changes from a single source file to one or more destination pages.&lt;/p></description></item></channel></rss>