feat(theme): add site footer and marketing sections
- Add SiteFooter, rendered through the Layout bottom slot so it appears on every page type. themeConfig.footer is deliberately left unset: setting it would render the built-in HomeFooter as well, on the home page only. - Add a frontmatter-driven section system (advantages, contentGrid, techStack, cases and cta) with a single ordered array, so bands can be reordered or removed without touching code. - Bands render only when they have content, so an unfilled page degrades to its heading rather than showing empty boxes. - Add a SHOW_COPY_PLACEHOLDERS flag for drafting, false by default.
This commit is contained in:
14 files changed
+652
-3
No files matched your search
+50
-3
@@ -1,8 +1,13 @@
|
||||
import "./index.css"
|
||||
import type { DocLayoutProps } from "@rspress/core/theme-original"
|
||||
import { DocLayout as OriginalDocLayout } from "@rspress/core/theme-original"
|
||||
import type { DocLayoutProps, LayoutProps } from "@rspress/core/theme-original"
|
||||
import {
|
||||
DocLayout as OriginalDocLayout,
|
||||
Layout as OriginalLayout,
|
||||
} from "@rspress/core/theme-original"
|
||||
import { Tags } from "./components/Tags"
|
||||
import { Author } from "./components/Author"
|
||||
import { SiteFooter } from "./components/SiteFooter"
|
||||
import { HomeSections } from "./components/HomeSections"
|
||||
|
||||
function DocLayout(props: DocLayoutProps) {
|
||||
return (
|
||||
@@ -24,6 +29,48 @@ function DocLayout(props: DocLayoutProps) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the stock `Layout` to add the site-wide footer and the frontmatter
|
||||
* driven marketing sections.
|
||||
*
|
||||
* `bottom` is rendered for every page type (home, doc, doc-wide, custom and
|
||||
* blank), so this is the one place the footer needs to be attached. Note that
|
||||
* the original `Layout` resolves `DocLayout` from `@rspress/core/theme` — the
|
||||
* alias for this directory — so the override above is picked up automatically.
|
||||
*
|
||||
* `afterFeatures` covers the home page and sits below the stock hero and
|
||||
* features grid; `afterDoc` covers products, services and any other doc page
|
||||
* that declares `sections`. `afterDoc` is a sibling of the doc container rather
|
||||
* than part of the prose column, so sections placed there stay full-bleed.
|
||||
* `HomeSections` renders nothing without the frontmatter, and the two slots are
|
||||
* never both live on the same page.
|
||||
*/
|
||||
function Layout(props: LayoutProps) {
|
||||
return (
|
||||
<OriginalLayout
|
||||
{...props}
|
||||
bottom={
|
||||
<>
|
||||
{props.bottom}
|
||||
<SiteFooter />
|
||||
</>
|
||||
}
|
||||
afterFeatures={
|
||||
<>
|
||||
{props.afterFeatures}
|
||||
<HomeSections />
|
||||
</>
|
||||
}
|
||||
afterDoc={
|
||||
<>
|
||||
{props.afterDoc}
|
||||
<HomeSections />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export * from "@rspress/core/theme-original"
|
||||
export { DocLayout }
|
||||
export { DocLayout, Layout }
|
||||
export { Kbd } from "./components/Kbd"
|
||||
Reference in new issue
Block a user