Skip to content

Commit

Permalink
feat: allow user to set ViewTransition Astro component in each page
Browse files Browse the repository at this point in the history
  • Loading branch information
abosch19 committed Sep 9, 2023
1 parent def7105 commit 4b477fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/starlight/layout/Page.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
import config from 'virtual:starlight/user-config';
import type { MarkdownHeading } from 'astro';
import { ViewTransitions } from 'astro:transitions';
import { getSidebar } from '../utils/navigation';
import type { Route } from '../utils/routing';
Expand Down Expand Up @@ -84,6 +86,7 @@ const pagefindEnabled =
}
}
</style>
{ entry.data.viewTransitions && <ViewTransitions /> }
</head>
<body>
<ThemeProvider />
Expand Down
6 changes: 6 additions & 0 deletions packages/starlight/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ export function docsSchema() {
*/
template: z.enum(['doc', 'splash']).default('doc'),

/**
* Set ViewTransitions Astro component for this page.
*
*/
viewTransitions: z.boolean().optional().default(false),

/** Display a hero section on this page. */
hero: z
.object({
Expand Down

0 comments on commit 4b477fc

Please sign in to comment.