deno_doc icon indicating copy to clipboard operation
deno_doc copied to clipboard

``deno doc --html`` generating incorrect url reference in subpages

Open RPDJF opened this issue 1 year ago • 2 comments

This issue seems to correlate with this issue on deno: https://github.com/denoland/deno/issues/25069

Link references on deno doc --html aren't correctly generated in subpages search queries, missing the base url

I have a production scenario where it doesn't work:

Actually hosting my doc through github pages (note that even simply opening index.html will result on same issue): https://rpdjf.github.io/Jikan.js/

Research on the man page works as expected, the links aren't broken: https://rpdjf.github.io/Jikan.js/?q=jikanclient

But once we are on a subpage, like this: https://rpdjf.github.io/Jikan.js/~/JikanClient.html

The research query will only display broken url references: https://rpdjf.github.io/Jikan.js/~/JikanClient.html?q=animeManager

Now, when clicking on any of the search result, we end up with a 404 error, for example: https://rpdjf.github.io/~/animeManager.html

These new research queries seems to remove the base url, returning: https://rpdjf.github.io/~/animeManager.html instead of https://rpdjf.github.io/Jikan.js/~/animeManager.html

It seems like we lose the base url or something at some point

Using deno 2.1.4

Doc built with deno doc --html --name="Jikan.JS" .\src\v4\index.ts from root project folder

RPDJF avatar Jan 01 '25 15:01 RPDJF

I noticed that I can reliably reproduce this based on the order of my deno.json exports, i.e.

This works perfectly

{
  "exports": {
    "./src/index.ts": "./src/index.ts",
    ".": "./src/index.ts",
    // ...
}

This builds with incorrect paths

{
  "exports": {
    ".": "./src/index.ts",
    "./src/index.ts": "./src/index.ts",
    // ...
}

So I guess if the first map (is that considered the default entry point?) has a different path level to the actual file, or shorter path than the rest of the exports?

Tagging @crowlKats since we were just in touch on a different docs issue 😅

gadicc avatar Aug 21 '25 09:08 gadicc

Just popping by to confirm @gadicc's observation, I ran into this as well. Not ending on a "." export broke all doc pages but the landing page.

AljoschaMeyer avatar Oct 10 '25 16:10 AljoschaMeyer