fern icon indicating copy to clipboard operation
fern copied to clipboard

Appending `/~explorer` to a relative URL causes base URL directory to be ignored

Open woodrow opened this issue 10 months ago • 2 comments

How urgent is this?

P0 - Critical (Blocking work)

What's the issue?

Steps to reproduce:

  1. Set up docs.yml to have the docs root directory be a subdirectory of the server (i.e. fern.docs.buildwithfern.com/learn
  2. Create a <Card> component with a relative href pointing at the API explorer for a given endpoint:
<Card
    title="API Explorer"
    icon="fa-regular fa-telescope"
    href="/api-reference/tokens/generate/~explorer"
>
    Explore the API from the comfort of your browser.
</Card>
  1. Publish the site (or run fern docs dev) and notice that the href property of the link for the card does not include the docs root subdirectory.

Expected: <a href="/learn/api-reference/tokens/generate/~explorer">...</a> Actual: <a href="/api-reference/tokens/generate/~explorer">...</a>

Fern CLI & Generator Versions

Fern CLI version 0.57.16

woodrow avatar Apr 03 '25 23:04 woodrow

This might actually have been an error on my part—are all hrefs supposed to include the path from the hostname to the Fern site root (i.e. /learn in my example)? In other words, is the href property in my example actually supposed to be /learn/api-reference/tokens/generate/~explorer?

If so this might just be an area for improvement in the docs about links and what the link href path should be relative to. Not including the /learn part was working for me, but it was also causing problems with fern check --broken-links, which made me wonder if it wasn't correct.

woodrow avatar Apr 08 '25 04:04 woodrow

Separately it'd be wonderful for fern check --broken-links to handle the ~explore url suffix on API references!

woodrow avatar Apr 08 '25 04:04 woodrow

Closing this issue, since the link format for the API Explorer has now changed.

chdeskur avatar Jul 12 '25 16:07 chdeskur