By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
For aspiring technical writers, developers transitioning into writing, and writers modernizing their skills
Content reuse and single-sourcing mean writing content once and reusing it across multiple documents, formats, or outputs—like a single API description appearing in a reference guide, a tutorial, and a CLI help command. This saves time, reduces errors, and keeps docs consistent. Real-world example: A payment gateway API (e.g., Stripe) might reuse the same "Create a Charge" endpoint description in: - The API reference (Swagger UI) - A getting-started guide (Markdown in GitHub) - A CLI tool’s --help output (man pages) - A mobile SDK’s inline docs (Javadoc/Doxygen)
--help
Without reuse, you’d manually update the same info in four places—guaranteeing drift and frustration.
{{product_name}}
.. include::
@props
ifdef
{% if user.role == "admin" %}...{% endif %}
<step>
Example: Search for "404 Not Found" in your docs—it likely appears in 5+ places.
Choose a reuse method
{% include "snippets/prerequisites.md" %}
{{site.product_name}}
For OpenAPI: Define reusable schemas (e.g., ErrorResponse used in 20 endpoints).
ErrorResponse
Extract reusable content
snippets/api-auth.md
Example: A curl example for authentication: markdown # snippets/auth-curl.mdbash curl -X POST {{api_base_url}}/auth \ -H "Authorization: Bearer {{api_key}}"
markdown # snippets/auth-curl.md
Add variables/conditions
{{api_base_url}}
Add conditions for platform-specific content (e.g., {% if target == "linux" %}...{% endif %}).
{% if target == "linux" %}...{% endif %}
Test the output
Build docs locally (e.g., npm run build for Docusaurus) and verify:
npm run build
Automate updates
mkdocs build
main
Mistake: Hardcoding values (e.g., https://api.stripe.com/v1) instead of using variables. Correction: Use {{api_base_url}} so you can update it in one place (e.g., for staging vs. production). Why: Avoids manual find-and-replace across 100 files.
https://api.stripe.com/v1
Mistake: Creating "Frankenstein snippets" (e.g., a "Prerequisites" snippet that’s 80% reusable but needs tweaks for each guide). Correction: Break snippets into smaller, atomic chunks (e.g., prerequisites-python.md, prerequisites-node.md). Why: Smaller snippets are easier to reuse and maintain.
prerequisites-python.md
prerequisites-node.md
Mistake: Overusing conditions (e.g., @props="linux,windows,mac" on every paragraph). Correction: Group related content into conditional blocks (e.g., a single <div> for Linux-only steps). Why: Too many conditions make docs unreadable and slow to build.
@props="linux,windows,mac"
<div>
Mistake: Not documenting reuse rules (e.g., "Don’t edit this file—it’s included in X, Y, Z"). Correction: Add a comment at the top of reusable files: ```markdown <!-- WARNING: This snippet is reused in:
Mistake: Ignoring tool limitations (e.g., trying to use DITA conrefs in Markdown). Correction: Match the reuse method to your toolchain (e.g., Markdown → includes/variables; DITA → conrefs). Why: Avoids broken builds and frustration.
Can you debug reuse issues? (e.g., "A snippet isn’t rendering in the PDF output—how do you fix it?")
Portfolio tips:
snippets/
components/schemas/Error
Explain your choices: In a README, describe why you used snippets vs. variables for a specific case.
Tricky distinctions to know:
components
Scenario: A developer updates an API endpoint but forgets to update the docs. The docs use snippets for endpoint descriptions. How do you ensure the docs stay in sync? Answer: Store the snippet in the same repo as the code (e.g., api-docs/snippets/endpoint.md) and add a pre-commit hook or CI check to verify the snippet matches the OpenAPI spec. Why: Co-locating docs and code reduces drift.
api-docs/snippets/endpoint.md
Scenario: Your team wants to publish the same guide for Linux, Windows, and macOS, but 20% of the content is platform-specific. How do you structure the docs? Answer: Use conditional text (e.g., DITA @props or AsciiDoc ifdef) to hide/show platform-specific sections. Why: Single-sourcing avoids duplicating 80% of the content.
Scenario: A writer complains that snippets make docs harder to edit because they have to jump between files. How do you respond? Answer: Balance reuse with readability—use snippets for truly repeated content (e.g., API descriptions) but inline unique content. Add clear comments linking to included files. Why: Overusing snippets can fragment docs.
{% include "snippets/example.md" %}
.. include:: snippets/example.md
{{ site.title }}
<step conref="tasks/common.dita#common/step1"/>
components/schemas/
$ref
ifdef::linux[] ... endif::linux[]
definitions
git push
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.