{"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"partial-tag","__idx":0},"children":["Partial tag"]},{"$$mdtype":"Tag","name":"ConfigOptionRequirements","attributes":{"products":["Revel","Reef","Realm"],"plans":["Pro","Enterprise","Enterprise+"]},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["partial"]}," tag enables you to reuse content across your documentation, bringing the concept of single-source publishing to your technical writing."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"syntax-and-usage","__idx":1},"children":["Syntax and usage"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["partial"]}," tag to render content pulled from a file in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_partials"]}," folder."," ","The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["file"]}," attribute is used to pass a pointer to the source file."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example syntax:"]}]},{"$$mdtype":"Tag","name":"MarkdocExample","attributes":{"renderDemo":false,"title":"/docs/setup.md","language":"markdoc","demoContent":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"setup-steps"},"children":["Setup steps"]}],"rawContent":"## Setup steps\n\n{% partial file=\"/_partials/tutorial-first-steps.md\" /%}\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-partials-in-redocly","__idx":2},"children":["Use partials in Redocly"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Redocly-specific implementation"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The information in this section applies specifically to using partials in a ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Redocly project"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"use-partial-folders","__idx":3},"children":["Use partial folders"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In Redocly, content is only exposed for reuse when a file is stored in a ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["designated partials folder"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, add partials by moving files into a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_partials"]}," folder in the root of your project."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configure custom folder names"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use a different name for your reused content, add the following configuration to your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly.yaml"]}," file:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"markdown:\n  partialsFolders:\n    - snippets\n    - shared-content\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can add multiple folder names if you have multiple folders for storing partials."," ","After adding the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["partialsFolders"]}," configuration, the default ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["_partials"]}," folder name will no longer work unless explicitly included in the configuration."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Folder requirements"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Partial files don't need special front matter or naming conventions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If you have images in partials, add an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["images"]}," folder to the partials folder"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Content must be placed in a designated partials folder to be reusable"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"the-raw-partial-tag","__idx":4},"children":["The raw-partial tag"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["raw-partial"]}," tag serves a similar purpose to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["partial"]}," tag but with an important difference in processing order."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The standard ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["partial"]}," tag renders the partial content after processing the main document."," ","The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["raw-partial"]}," tag includes the partial content first, before any other processing occurs."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use like ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{% raw-partial file=\"...\"}"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":5,"id":"when-to-use-raw-partial","__idx":5},"children":["When to use raw-partial"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["raw-partial"]}," tag in these scenarios:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When using reference-style Markdown links in your partial content"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When composing parts of a table (such as adding rows)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When the partial needs to be processed as part of the main document's context"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["raw-partial"]}," tag allows the included content to be treated as if it were written directly in the main document."," ","This makes it suitable for cases where the processing order matters."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"limitations-of-partials","__idx":6},"children":["Limitations of partials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reference links"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Don't use ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://www.markdownguide.org/basic-syntax/#reference-style-links"},"children":["reference-style Markdown links"]}," inside the partial because they resolve incorrectly upon page load."," ","For links inside a partial, absolute links are the best approach."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"attributes","__idx":7},"children":["Attributes"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"width":"15%","data-label":"Option"},"children":["Option "]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["file"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The relative or absolute path to the source file used as a partial."," ","Must be stored in a ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"#use-partial-folders"},"children":["partials folder"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["variables"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["object"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Key value pairs that can be accessed from inside the partial."," ","Useful for conditional rendering and dynamic content."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":8},"children":["Examples"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"add-a-shared-content-section","__idx":9},"children":["Add a shared content section"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example demonstrates using partials to add a Learning Resources section across different guides or tutorials."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example partial content:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","data-title":"/_partials/redocly-cli-resources.md","header":{"title":"/_partials/redocly-cli-resources.md","controls":{"copy":{}}},"source":"The following resources help you learn more about the Redocly CLI:\n\n- [Redocly CLI commands](/docs/cli/commands/index.md) - Learn the commands built into the CLI.\n- [Configure API linting](/docs/cli/guides/configure-rules.md) - Learn how to tailor the Redocly CLI linting for your own needs.\n- [Redocly CLI cookbook](https://github.com/Redocly/redocly-cli-cookbook) - Bite-sized example CLI customizations to inspire your own.\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example partial syntax:"]}]},{"$$mdtype":"Tag","name":"MarkdocExample","attributes":{"renderDemo":false,"title":"docs/cli/install.md","language":"markdoc","demoContent":[],"rawContent":"{% partial file=\"/_partials/redocly-cli-resources.md\" /%}\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pass-variables-to-partials","__idx":10},"children":["Pass variables to partials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This example demonstrates passing values to a partial using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["variables"]}," attribute:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example partial content:"]}]},{"$$mdtype":"Tag","name":"MarkdocExample","attributes":{"renderDemo":false,"title":"/_partials/fav-food.md","language":"markdoc","demoContent":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[null,"'s favorite food is ",null,"."]}],"rawContent":"{% $person %}'s favorite food is {% $favFood %}.\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example partial syntax:"]}]},{"$$mdtype":"Tag","name":"MarkdocExample","attributes":{"renderDemo":false,"title":"docs/about.md","language":"markdoc","demoContent":[],"rawContent":"{% partial\n  file=\"/_partials/favorite-food.md\"\n  variables={\n    person: \"Taylor\",\n    favFood: \"Katsu curry\"\n  }\n/%}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Rendered output:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Taylor's favorite food is Katsu curry."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"best-practices","__idx":11},"children":["Best practices"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Partials are especially useful for repeatable content where you want to maintain a central source of truth."," ","Partials add value by improving writer productivity, ensuring information consistency, or reducing maintenance costs."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create descriptive filenames"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Give your partial a descriptive filename to help authors understand what content to expect."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Make partials composable"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All partials ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["render as a whole"]},", meaning all content inside the source file renders."," ","Content should be self-contained enough to be used throughout other documents without additional context."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Use code-snippet for code partials"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a partial contains only code, consider using the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/realm/content/markdoc-tags/code-snippet"},"children":["code snippet tag"]}," instead."," ","The code snippet tag allows you to insert specific parts of a code sample, providing more flexibility."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Use absolute links over relative"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use absolute links in your partials to ensure they resolve correctly everywhere the content is reused."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Nest with caution"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Partials can be nested, but this can create confusion for authors."," ","If using nesting, create a folder structure that keeps organization clear."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"resources","__idx":12},"children":["Resources"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://redocly.com/learn/markdoc"},"children":["Markdoc overview for technical writers"]}]}," - Learn how to use Markdoc in your documentation"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/docs/realm/content/markdoc-tags"},"children":["Markdoc tags"]}]}," - See the full list of supported Markdoc tags"]}]}]},"frontmatter":{"products":["Revel","Reef","Realm"],"plans":["Pro","Enterprise","Enterprise+"]},"tagList":["admonition","configOptionRequirements","markdoc-example","table"],"title":"Partial tag","lastModified":"2026-08-24T16:21:33.000Z"}