Repository navigation
Empty template with just the navbar #3354
Replies: 4 comments 2 replies
|
Thanks for starting this discussion 🙌 I guess there are a few points to consider and clarify to properly identify the proper solution, decide which customizations should be left to CSS, what should be a new template, etc. First, I guess an important question from #3300 was about the issue itself, and what exactly is the issue, e.g. is it the margins, and what are the use cases exactly for such a template. Would you be able to clarify that? One important point is also what Regarding #1112, it seems like the request is also about a page that has a full-width layout. Is this covered by the Really curious to hear your thoughts on all of this. |
|
Hello! In the simplest way possible, I just want to be able to do this. And right now it's not possible, the only way is via this: :global(#_top) {
display: none;
}
:global(footer) {
display: none;
}Because even in the I agree with you @HiDeoo that I don't really mind the name too much, as long as it's possible. |
|
How are you hiding the "Hello" should not be coming from the |
|
I had a similar use case and want to share my solution. I needed to create custom landing pages with my own components and UI while still reusing Starlight's navbar, theme context, and styles. Here's the approach I took: 1. Extended the docs schemaI added an export const collections = {
docs: defineCollection({
loader: docsLoader(),
schema: docsSchema({
extend: (context) => blogSchema(context).extend({
emptyPage: z.boolean().optional(),
})
})
}),
};2. Created a reusable EmptyPage layoutI created ---
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
interface Props {
title: string;
}
const { title } = Astro.props;
---
<StarlightPage frontmatter={{ title, template: 'splash', emptyPage: true }} hasSidebar={false}>
<slot />
</StarlightPage>3. Override key componentsOverride the ---
import Default from '@astrojs/starlight/components/ContentPanel.astro';
const isEmptyPage = Astro.locals.starlightRoute.entry.data.emptyPage;
---
{isEmptyPage ? (
<div class="content-panel empty-page">
<div class="sl-container"><slot /></div>
</div>
) : (
<Default {...Astro.props}><slot /></Default>
)}
<style>
.empty-page .sl-container {
max-width: none;
}
</style>The other overrides follow the same pattern - they check 4. UsageNow I can create custom pages like this: ---
import EmptyPage from '@/layouts/EmptyPage.astro';
---
<EmptyPage title="My Title">
<!-- Custom content here -->
</EmptyPage>This approach gives me a completely clean canvas while maintaining the navbar, theme system, and Starlight context. The key insight is using the Hope this helps others with similar requirements! |



Uh oh!
There was an error while loading. Please reload this page.
What version of
starlightare you using?latest
What is your idea?
There is currently no way to create a completely empty
StarlightPagethat just contains the navbar and nothing elseI suggest a
template: "empty"that is similar to"splash"but doesn't include a title or a footerI'm happy to submit a PR again.
This was requested before by #3300 and #1112 and other people who probably gave up
Why is this feature necessary?
Right now the only way to achieve this is to add these CSS rules:
Which is... not good
Do you have examples of this feature in other projects?
No response
Participation
All reactions