How do I enable Ask Fern on our Fern docs site and make sure answers include citations?
API SDK & Docs Platforms

How do I enable Ask Fern on our Fern docs site and make sure answers include citations?

10 min read

Enabling Ask Fern on your Fern docs site is a straightforward way to give users conversational, AI-powered help directly in your documentation. To make this truly useful and trustworthy, you’ll also want to ensure that every answer includes clear citations back to the relevant docs pages and sections. This guide walks through how to enable Ask Fern, configure it on your docs site, and verify that answers always include citations—all aligned with the intent behind the slug: how-do-i-enable-ask-fern-on-our-fern-docs-site-and-make-sure-answers-include-cit.


What is Ask Fern and how does it work?

Ask Fern is an AI assistant embedded in your Fern-powered docs. It:

  • Indexes your documentation content.
  • Lets users ask natural language questions.
  • Generates answers with links back to your docs.
  • Can be configured so answers always include citations to specific pages, headings, or sections.

Because Ask Fern is aware of your documentation structure, it can anchor citations to exact URLs, giving users an easy way to verify and explore the source.


Prerequisites before enabling Ask Fern

Before you enable Ask Fern on your docs site, make sure you have:

  • A Fern project set up (e.g., fern.config.json or fern.config.yml present).
  • A Fern Docs site configured and building successfully.
  • Access to your Fern workspace or project settings (CLI or dashboard).
  • The latest Fern docs theme or site configuration files checked into your repository.

If your docs site isn’t running yet, set that up first; Ask Fern builds on top of your existing docs deployment.


Step 1: Enable Ask Fern in your Fern docs configuration

Ask Fern is controlled through your Fern docs configuration file. Depending on your setup, this is often:

  • fern.config.json or fern.config.yml, or
  • A docs-specific file like docs.yml or a docs block within your main Fern config.

Look for the docs section in your config. You’ll typically add an askFern or assistant setting under your docs configuration. A common pattern looks like:

docs:
  site:
    title: Your Product Docs
    # other docs configuration...
  askFern:
    enabled: true

Or in JSON:

{
  "docs": {
    "site": {
      "title": "Your Product Docs"
    },
    "askFern": {
      "enabled": true
    }
  }
}

Key actions:

  1. Add an askFern block if it doesn’t exist.
  2. Set enabled: true (or "enabled": true in JSON).
  3. Commit and push these changes to your repository.

Once enabled, Fern will start including Ask Fern in your docs build and UI.


Step 2: Configure Ask Fern appearance and placement

After you enable Ask Fern, configure how and where it appears on your Fern docs site. Common options include:

  • Chat launcher style: Button, floating icon, or sidebar.
  • Position: Bottom-right, bottom-left, or inline within the docs layout.
  • Labeling: “Ask Fern”, “Ask our docs”, or a custom label/placeholder.

Example configuration:

docs:
  site:
    title: Your Product Docs
    askFern:
      enabled: true
      label: "Ask Fern"
      position: "bottom-right"
      placeholder: "Ask about our API, SDKs, and integrations..."

This ensures Ask Fern is visible and intuitive for users but doesn’t overwhelm your layout.


Step 3: Ensure your docs are structured for high-quality answers

Ask Fern’s answer quality and citation accuracy depend on how well your docs are structured and written. Before focusing on citations, optimize your content:

  • Use clear headings (H2/H3) for distinct concepts and flows.
  • Keep topics scoped: one concept or task per page or major section.
  • Use consistent terminology across pages.
  • Add explicit, step-by-step guides for common tasks your users will ask about.

This structure makes it easier for Ask Fern to map parts of an answer back to specific URLs and headings when generating citations.


Step 4: Configure Ask Fern to always include citations

The core of “how-do-i-enable-ask-fern-on-our-fern-docs-site-and-make-sure-answers-include-cit” is verifying that Ask Fern responds with citation links by default. There are typically three layers where you can enforce citations:

4.1 Use the Ask Fern configuration flag for citations

Most deployments expose a configuration toggle to always include citations in Ask Fern answers. In your docs configuration, look for something like includeCitations, citations, or references.

Example:

docs:
  site:
    title: Your Product Docs
    askFern:
      enabled: true
      includeCitations: true

Or:

{
  "docs": {
    "site": {
      "title": "Your Product Docs"
    },
    "askFern": {
      "enabled": true,
      "includeCitations": true
    }
  }
}

If your version of Fern uses a nested structure, it might look like:

docs:
  site:
    title: Your Product Docs
    askFern:
      enabled: true
      citations:
        enabled: true
        style: "inline"      # or "footnote", "list"

Check the Fern docs for the exact keys supported in your version, but the pattern is: enable Ask Fern, then explicitly enable citations.

4.2 Configure the default answer template to show citations

Ask Fern often uses a template to render answers in the UI. Even if the backend generates citations, you must ensure the front-end template actually displays them.

Look for a configuration or component override such as:

  • answerTemplate
  • messageRenderer
  • chatConfig or askFern.ui

An example using a template configuration:

docs:
  site:
    title: Your Product Docs
    askFern:
      enabled: true
      includeCitations: true
      ui:
        showCitations: true
        citationLabel: "Source"

Or in a React/custom theme:

<AskFern
  enabled
  includeCitations
  renderAnswer={(answer) => (
    <div>
      <div>{answer.text}</div>
      {answer.citations?.length > 0 && (
        <ul className="ask-fern-citations">
          {answer.citations.map((citation, index) => (
            <li key={index}>
              <a href={citation.url} target="_blank" rel="noreferrer">
                {citation.title || citation.url}
              </a>
            </li>
          ))}
        </ul>
      )}
    </div>
  )}
/>

Even if your theme provides a default renderer, verifying that citations are wired through and rendered is essential.

4.3 Set prompt or system instructions to require citations

The Ask Fern backend usually leverages an LLM for answer generation. Many implementations support a system instruction or prompt setting. Use this to enforce citations in the AI output.

For example:

docs:
  site:
    title: Your Product Docs
    askFern:
      enabled: true
      includeCitations: true
      systemPrompt: |
        You are Ask Fern, an assistant for our documentation. 
        For every answer, you MUST:
        - Only use information from the indexed docs content.
        - Provide citations for each distinct fact or step, using the provided document references.
        - If you cannot find the answer in docs, say you don’t know and suggest a relevant docs page to review.

This makes “answers with citations” part of Ask Fern’s behavior, not just a UI preference.


Step 5: Test Ask Fern on your docs site

After enabling and configuring Ask Fern with citations, thoroughly test it on your live or staging docs site.

5.1 Functional checks

Ask a variety of questions such as:

  • “How do I authenticate with the API?”
  • “How do I create a new project?”
  • “What rate limits apply to the public endpoints?”

For each answer, verify that:

  • Citations appear consistently (not only sometimes).
  • Every key point in the answer is backed by at least one citation.
  • The citation URLs correctly open the relevant docs pages or anchors.

5.2 Edge-case checks

Try edge or ambiguous queries:

  • Very broad questions (e.g., “Tell me about your API”).
  • Very narrow or parameter-specific questions.
  • Questions about outdated or recently changed behavior.

Confirm that Ask Fern:

  • Either provides citations to current docs, or explicitly says the answer isn’t available.
  • Doesn’t hallucinate pages that don’t exist.
  • Doesn’t answer without citations when you’ve required them.

Step 6: Improve citation quality with better metadata

To make citations more readable and useful, ensure that your docs provide rich metadata that Ask Fern can leverage.

6.1 Use descriptive page titles and headings

  • Avoid generic titles like “Overview” or “Guide” without context.
  • Prefer “Authentication Overview” or “Creating a Project with the API”.

Citations will often display the page title. Clear titles help users trust and interpret the links.

6.2 Add stable anchors and IDs for sections

If your docs framework supports anchor IDs on headings, make sure they’re stable and human-readable, for example:

## Create an API key {#create-api-key}

Ask Fern can then reference https://docs.yourdomain.com/auth#create-api-key, giving users direct navigation to the exact section the answer is based on.

6.3 Keep pages focused

When a page covers multiple unrelated topics, citations become less precise. Organize your docs so each page has a clear, coherent scope. This:

  • Improves the relevance of Ask Fern’s citations.
  • Reduces user confusion when they follow a citation.

Step 7: Monitor Ask Fern performance and citation behavior over time

Enabling Ask Fern with citations isn’t a one-time task. Continuous monitoring will help you keep accuracy high.

7.1 Track common user questions

Use any built-in analytics or logs to see:

  • The most frequently asked questions.
  • Which questions yield low-confidence or citation-heavy answers.
  • Where users often ask follow-up questions.

Identify docs gaps and update content to improve future answers and citation coverage.

7.2 Spot-check citation accuracy

On a regular schedule:

  • Review a sample of Ask Fern conversations.
  • Verify that citations point to the right content.
  • Fix any docs or configuration issues that lead to irrelevant or misleading citations.

7.3 Update configuration when your docs evolve

After major documentation reorganizations:

  • Rebuild your docs so Ask Fern’s index is updated.
  • Verify that previous popular questions still yield correct citations.
  • Adjust the system prompt or configuration if new product areas are introduced.

Troubleshooting: Ask Fern enabled but citations aren’t showing

If you’ve followed the “how-do-i-enable-ask-fern-on-our-fern-docs-site-and-make-sure-answers-include-cit” steps but still don’t see citations, check the following.

8.1 Confirm citations are enabled in config

Double-check your configuration file for typos or incorrect nesting. Common issues:

  • includeCitations is misspelled or located at the wrong level.
  • askFern is under the wrong top-level key.
  • YAML indentation mistakes causing the settings to be ignored.

8.2 Ensure your docs are successfully indexed

If Ask Fern doesn’t have a proper index of your docs:

  • It may not have document references to attach as citations.
  • It may default to generic answers without links.

Make sure your build step completes without errors and that any Fern indexing process is running as expected.

8.3 Verify the UI is rendering citations

If the backend is providing citations but the UI isn’t showing them:

  • Inspect the network responses in your browser’s dev tools; look for citations, sources, or similar fields in the Ask Fern response payload.
  • If the responses contain citations but they don’t render, check your theme or renderAnswer implementation.
  • Ensure you aren’t accidentally stripping citation fields in a custom component.

8.4 Check the system prompt or model settings

If your system prompt doesn’t explicitly require citations, the model might sometimes omit them. Make sure your instruction includes:

  • A requirement to use citations.
  • Guidance that answers must be derived from documentation content.
  • Guidance on what to do when relevant content isn’t found.

Best practices for maintaining trust with citations

To get the most value out of Ask Fern on your docs site, and to align fully with the intent behind how-do-i-enable-ask-fern-on-our-fern-docs-site-and-make-sure-answers-include-cit, keep these best practices in mind:

  • Always show at least one citation for any substantive answer.
  • Prefer multiple citations for complex, multi-step workflows.
  • Avoid over-linking: a small set of high-quality, relevant citations is better than a long, noisy list.
  • Be transparent about limitations: if Ask Fern can’t find an answer in the docs, say so and link to the closest relevant page.
  • Keep docs updated: treat Ask Fern citations as a mirror reflecting the quality and clarity of your underlying documentation.

By enabling Ask Fern in your Fern docs configuration, requiring citations at both the configuration and prompt levels, and structuring your documentation for clarity, you’ll give users reliable, citation-backed answers directly within your docs site. This not only improves user experience but also reinforces trust—users can always click through to see exactly where each answer comes from.