Deploying to a subpath (base configuration)
#3660
Replies: 1 comment 4 replies
-
This is partially intentional, or at least, hard for us to definitively fix: while it’s true that a lot of links are usually internal, it’s also plausible for people to link “up” out of a Currently we handle That said, it’s still worth discussing options as it’s a question we get regularly enough (here’s a similar issue: #932) Maybe there’s a way to make this behaviour optional. A couple of things give me pause:
I did share an example plugin here a while back for Markdown links in case it helps: #1763 (reply in thread) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of
starlightare you using?0.37.3
What is your idea?
It would be nice if Starlight had an easy, well-documented way to create a website that can be hosted on a subpath.
Astro has a
baseconfiguration but it does not seem to be enough on its own. For example, it will create the correctdirectoryURL structure but it won't automatically prepend thebasepath to URLs in markdown. I'm correcting for this by writing a plugin, but this seems like something Starlight could potentially handle out-of-the-box.Why is this feature necessary?
This feature would be useful for anyone who already has a website running on the top level (
/) and wants to deploy their docs to a subpath (e.g./docs).It's unclear to me what is and isn't handled automatically (by Astro, by Starlight) when
baseis set. That's where clear documentation would be useful as well.I created two Stackblitz examples to demonstrate the current reality:
In both examples, any markdown links are broken (they don't include the BASE_URL). Further inspection shows that Starlight does automatically handle
basein some cases (e.g. in the sidebar links) but not for others (e.g.actionson the homepage don't include BASE_URL but only during dev).Not sure if this is the best place to discuss this because I can't tell what is working-as-intended vs bug vs missing feature vs missing documentation.
Do you have examples of this feature in other projects?
React Router automatically handles links when
basenameis set, but it's not the same situation because they do have explicit APIs (e.g.<Link>,useHref()).Participation
Beta Was this translation helpful? Give feedback.
All reactions