-
-
Notifications
You must be signed in to change notification settings - Fork 421
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved support for serving Starlight docs from a custom subpath #347
Comments
For a quick and hacky solution you can nest the |
Thanks for the quick solution. Seems to work alright, although I can't find a way to update the nav link in the header. It still points to the root url. |
Unfortunately configuring the starlight({
head: [
{
tag: 'script',
content: `window.addEventListener('load', () => document.querySelector('.site-title').href += 'docs/')`,
},
],
}); |
Thanks for the workaround. |
Thanks for the issue @mirrorleap! As @BryceRussell said, this workaround is available today and I just wrote some docs for this approach, but we would like to improve support here in the future. I think most likely would be something like a // astro.config.mjs
defineConfig({
integrations: [
starlight({
title: 'Docs at a subpath',
base: 'guides',
}),
],
}); This would prefix all Starlight routes with There are some questions around this still to answer:
|
It's a must have for me :) Suggestion to add more powerful customization:
|
Hey @jagu-sayan! As noted above this is already supported, we’d just like to improve the DX around it. Thanks for sharing your other ideas — things in this direction are all stuff on our radar 🙌 |
Hi @delucis, thanks for your response. I agree with your approach to have the
Here are my suggestions:
|
Hosts like Netlify, Vercel, and GitHub Pages have a very simple default behaviour where they look for a That said, if a user’s project already creates a root-level 404, then Starlight’s shouldn’t overwrite it. |
Making a note that it might not be super clear what happens to Which of these should the pattern be?
Usually language tags are the first segment in a URL path, but not sure if that’s what everyone looking for This wouldn’t impact |
Just came across an issue with starlight being incompatible with a custom 404 page. A base URL option would be great as I don't want to expose the documentation whenever a user enters a wrong URL in general. |
@delucis as we have discussed in Discord, would like to get this issue! I have a branch as you can see in the historic of the issue. I figured out how to add baseUrl at the configs, but not the right entry point to make it work! |
I'd personally put the language before the base path, but imho it should be a selectable option. If you have a monolingual site, with multi-lingual docs, then after the base path makes sense, if everything is multilingual having the language path moved in the middle of the path makes no sense. |
If there's multiple starlight sites in the same origin, should theme selection also be separated? Currently starlight is using hardcoded
Example of separated theme selection implemented in mkdocs-material, they are prepending the base path to the key. Excerpt of formatted source of __md_scope=new URL(".",location)
__md_get=(e, _=localStorage, t=__md_scope) => JSON.parse(_.getItem(t.pathname+"."+e)) Excerpt of formatted source of __md_scope=new URL("..",location) Excerpt of formatted source of __md_scope=new URL("../../../../..",location) |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
What version of
starlight
are you using?0.5.2
What is your idea?
Starlight integration helps to easily build documentation with Astro. However, by default, it converts the entire Astro site into a documentation site. It will be a useful feature if Starlight docs can be served from a custom path.
Why is this feature necessary?
Astro has a unique feature that allows for multiple integrations including UI frameworks and other functionality. Starlight is one of those exciting integrations.
Allowing Starlight docs to be served from a sub/custom path, will have the following benefits:
Do you have examples of this feature in other projects?
Example -
Route(s) for Astro site content:
Route(s) For Starlight docs within Astro site:
Participation
The text was updated successfully, but these errors were encountered: