Files
onixbyte.com/theme/index.tsx
T
zihluwang 638c71da44 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.
2026-09-25 14:48:42 +08:00

77 lines
2.1 KiB
TypeScript

import "./index.css"
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 (
<OriginalDocLayout
{...props}
beforeOutline={
<>
<Author className="mx-4 md:mx-0" />
{props.beforeOutline}
</>
}
afterDocContent={
<>
{props.afterDocContent}
<Tags />
</>
}
/>
)
}
/**
* 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, Layout }
export { Kbd } from "./components/Kbd"