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
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Type of the project's `i18n.json`, for use with `useI18n()`.
|
||||
*
|
||||
* `useI18n<T>()` is generic over the keys *beyond* Rspress's built-in set:
|
||||
*
|
||||
* useI18n<T>(): (key: keyof (T & I18nText), params?) => string
|
||||
*
|
||||
* Without a type argument, `T` defaults to `unknown` and only the built-in keys
|
||||
* type-check — looking up one of our own keys (`footer.copyright`, say) is then
|
||||
* an error. Passing this type fixes that for every key in `i18n.json`, and stays
|
||||
* correct automatically as keys are added.
|
||||
*
|
||||
* `typeof import(...)` is a type-level import, so this costs nothing at runtime
|
||||
* and the JSON is not pulled into the client bundle.
|
||||
*/
|
||||
export type CustomI18n = typeof import("../../i18n.json")
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Site-wide constants shared by theme components.
|
||||
*
|
||||
* Kept here rather than in `rspress.config.ts` so the client bundle can import
|
||||
* them without pulling in the Node-side config.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mainland China ICP filing number, as issued.
|
||||
*
|
||||
* Shown on both targets: the `.com` site redirects mainland-China visitors to
|
||||
* `.cn`, so it is the filing number for the domain they land on either way.
|
||||
*/
|
||||
export const ICP_NUMBER = "湘ICP备2026042635号-1"
|
||||
|
||||
/** Ministry of Industry and Information Technology filing portal. */
|
||||
export const MIIT_URL = "https://beian.miit.gov.cn/"
|
||||
|
||||
/** Locale-relative paths. Prefix with the active language before use. */
|
||||
export const PRIVACY_PATH = "/legal/privacy"
|
||||
export const TERMS_PATH = "/legal/terms"
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Inline SVG markup for social links that Rspress ships no preset icon for.
|
||||
*
|
||||
* Values are injected verbatim as innerHTML by the theme's `SocialLink`
|
||||
* component, so each must be a complete `<svg>` element. Match the shape
|
||||
* Rspress uses for its presets so the icons sit consistently in the nav bar:
|
||||
*
|
||||
* <svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 24 24">
|
||||
* <path fill="currentColor" d="…" />
|
||||
* </svg>
|
||||
*
|
||||
* `width="100%"` lets the nav bar size the glyph; the viewBox carries the
|
||||
* aspect ratio, so keep whatever coordinate system the source artwork uses.
|
||||
* `fill="currentColor"` is essential — the presets all set it, and without it
|
||||
* a path defaults to solid black and disappears in dark mode.
|
||||
*
|
||||
* Rspress's built-in set covers Weibo, Bilibili, Zhihu, Juejin, QQ and WeChat,
|
||||
* but not Douyin. Adding such an icon to the preset registry is not possible
|
||||
* from userland — `getSocialIcons` throws on any name it does not recognise —
|
||||
* so a literal SVG string is the supported route.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Official Douyin mark.
|
||||
*
|
||||
* The source artwork is authored on a 1024×1024 grid and fills it exactly
|
||||
* (the glyph runs from y=0 to y=1024), so the viewBox is carried through
|
||||
* unchanged. Editor attributes from the export (`t`, `class`, `version`,
|
||||
* `p-id`, the fixed pixel `width`/`height`) have been dropped; `width="100%"`
|
||||
* and `fill="currentColor"` are set here instead.
|
||||
*/
|
||||
export const DOUYIN_ICON = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 1024 1024"><path fill="currentColor" d="M937.4 423.9c-84 0-165.7-27.3-232.9-77.8v352.3c0 179.9-138.6 325.6-309.6 325.6S85.3 878.3 85.3 698.4c0-179.9 138.6-325.6 309.6-325.6 17.1 0 33.7 1.5 49.9 4.3v186.6c-15.5-6.1-32-9.2-48.6-9.2-76.3 0-138.2 65-138.2 145.3 0 80.2 61.9 145.3 138.2 145.3 76.2 0 138.1-65.1 138.1-145.3V0H707c0 134.5 103.7 243.5 231.6 243.5v180.3l-1.2 0.1"/></svg>`
|
||||
Reference in new issue
Block a user