You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 94167a7
Browse filesBrowse the repository at this point in the historyBrowse files
|`@purestack/ts-page-scripts`|`analyticsPlugin()`| Direct or consent-managed GA4 integration |
104
+
|`@purestack/ts-seo`|`seoPlugin()`| Social previews, canonical URLs, and translated alternate links |
101
105
|`@purestack/ts-highlight`|`highlightPlugin()`| Shiki or highlight.js code highlighting |
102
106
|`@purestack/ts-pagefind`|`pagefindPlugin()`| Full-build and lazy development search indexing |
103
107
104
108
The stylesheet provider initializes before component factories, then all config hooks run in plugin order. Names do not affect initialization. Components belong to each build, so hooks can override them through `context.components`. The theme and page runtime plugins supply head templates that run before the selected page template, preserving its ability to inspect or change the completed head. The lifecycle hook set is unchanged.
105
109
110
+
Metadata defaults compose through `headConfig({ site, pageInfo })` in plugin order, before explicit frontmatter `head` overrides and before head markup is rendered. It returns `BasicHeadConfig` or a promise. The SEO plugin uses this contribution for Open Graph, Twitter, canonical URLs, and translated alternate links; page templates receive the completed `headConfig`. Basic titles, descriptions, explicit head settings, and `index: false` enforcement remain in core.
111
+
112
+
Auth hints, consent, and analytics are independent plugins in `ts-page-scripts`. The analytics plugin registers automatic GA4 consent services during `onConfigResolved`, before later config hooks and rendering. Omitting it removes automatic registration and direct tracking scripts. Explicitly configured consent services remain available. Analytics never bypasses enabled consent when the consent runtime plugin is omitted.
113
+
106
114
To choose the standard integrations yourself, disable the automatic set and list the plugins you want. The factories are exported from `purestack`, `@purestack/ts-ssg`, and their individual packages:
107
115
108
116
```ts
@@ -114,7 +122,7 @@ export default defineConfig({
114
122
})
115
123
```
116
124
117
-
This keeps the layouts and components while omitting page runtimes, code highlighting, and search indexing. Theme switching and favicon generation belong to the theme plugin. Tabs and Modal scripts belong to the page scripts plugin, including automatic component embeds and explicit frontmatter settings. Without the theme plugin, another plugin must supply your page templates and any CSS output you need.
125
+
This keeps the layouts and components while omitting automatic social metadata, page runtimes, code highlighting, and search indexing. Theme switching, favicon generation, and Markdown table wrappers belong to the theme plugin. Tabs and Modal scripts belong to the page scripts plugin, including automatic component embeds and explicit frontmatter settings. Without the theme plugin, another plugin must supply your page templates and any CSS output you need.
118
126
119
127
An explicitly listed standard plugin replaces the automatic instance by name and keeps its initialization position. You can also use `createDefaultPlugins()` to obtain the complete set. In programmatic builds, use `options.defaultPlugins` alongside `options.plugins`.
120
128
@@ -210,6 +218,8 @@ Besides the prepared `head` and the page's `bodyHtml`, a template receives the p
210
218
211
219
## Transform Markdown
212
220
221
+
Ordinary `rehypePlugins` run before `rehypePostPlugins`, which apply final presentation before outline collection and code highlighting. The theme plugin uses this final stage for `div.table-scroll`, so tables introduced by custom transforms receive the same scrolling behavior as source tables. Both stages run on pages and shared Markdown partials.
222
+
213
223
`markdown` adds <ahref="https://github.com/remarkjs/remark"target="_blank"rel="noopener">remark</a> plugins, which change the Markdown tree, and <ahref="https://github.com/rehypejs/rehype"target="_blank"rel="noopener">rehype</a> plugins, which change the HTML tree. Every page, header, and footer goes through these steps:
214
224
215
225
1. PureStack reads the Markdown. Regor markup, such as `<Badge tone="success">`, stays raw HTML.
@@ -534,8 +544,9 @@ Every field except `name` is optional.
It preserves site configuration, page layout gates, consent-aware analytics,
19
+
It preserves site configuration, page layout gates,
20
20
and the site's base path. Theme startup belongs to `@purestack/ts-theme`;
21
21
the plugin adds component-specific Tabs/Modal embeds through `onPageDocument`. Recorded component placement overrides frontmatter, and Tabs remains before Modal when both target the same parent.
22
22
23
23
To omit the page runtimes, set `defaultPlugins: false` in `purestack.config.ts`
24
24
or build options and list the other plugins you need.
25
25
26
+
Three separate plugins from this package are also enabled by default:
27
+
28
+
| Factory | Plugin name | Responsibility |
29
+
| --- | --- | --- |
30
+
|`authStateHintPlugin()`|`purestack:auth-state-hint`| Apply the signed-in hint before stylesheets load, when auth is enabled |
31
+
|`consentPlugin()`|`purestack:consent`| Initialize the consent browser runtime when consent is enabled |
32
+
|`analyticsPlugin()`|`purestack:analytics`| Add direct GA4 scripts without consent, or register the consent-managed GA4 service during `onConfigResolved`|
33
+
34
+
Each factory can be selected independently of `pageScriptsPlugin()`. Omitting
35
+
analytics removes automatic GA4 service registration as well as direct scripts;
36
+
explicit user-defined consent services are preserved. When consent is enabled,
37
+
analytics never bypasses it, including when the consent runtime plugin is omitted.
38
+
The raw `resolveSiteConfig` result contains only explicitly configured consent
39
+
services; automatic GA4 registration occurs when the analytics plugin initializes,
40
+
before later config hooks and page rendering.
41
+
26
42
For standalone `renderApp` calls, use `appendRuntimeScripts(document, runtimeEmbeds, frontmatter.embed)` from the renderer's `onRendered(document, runtimeEmbeds)` callback. The renderer itself has no knowledge of individual runtimes.
0 commit comments