@the-smithy/create-hearth-site 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-smithy/create-hearth-site",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Start a new client website powered by Hearth: pnpm create @the-smithy/hearth-site",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "devDependencies": {
31
31
  "vitest": "^5.0.3",
32
- "@the-smithy/hearth-schema": "^0.23.0"
32
+ "@the-smithy/hearth-schema": "^0.24.0"
33
33
  },
34
34
  "scripts": {
35
35
  "test": "node --test \"test/**/*.test.js\" && vitest run test/blocks.test.ts"
@@ -122,6 +122,21 @@ States are Tailwind variants inside the slot: `on-dark:` for blocks on an invers
122
122
  | `src/app/sitemap.ts`, `robots.ts` | Generated from Hearth. Search engines stay out until the site's web address is set |
123
123
  | `src/app/llms.txt/route.ts` | The site's summary for AI tools, generated from Hearth (not found until the site is live) |
124
124
 
125
+ ### Global blocks
126
+
127
+ Editors make blocks once in Hearth (Global blocks) and show them on pages, as pop-ups or in menu dropdowns; the
128
+ layout draws the pop-ups and dropdowns. To place one anywhere else in the site's own code, use its key (shown in
129
+ Hearth under "For developers"):
130
+
131
+ ```tsx
132
+ import { GlobalBlock } from "@/hearth/blocks/global";
133
+
134
+ <GlobalBlock name="newsletter" />
135
+ ```
136
+
137
+ `hearthNext.getGlobalBlocks()` lists every global block (key, name, type, pop-up, the pages and menu items it's on,
138
+ the resolved block); `hearthNext.getGlobalBlock(keyOrId)` gets one.
139
+
125
140
  ## Deploying to Netlify
126
141
 
127
142
  Do these in order: the webhook's signing secret only exists once the webhook URL is saved.
@@ -0,0 +1,16 @@
1
+ import { hearthNext } from "../client";
2
+ import { Blocks } from "./index";
3
+
4
+ /**
5
+ * One of the site's global blocks (Global blocks in Hearth), by key or id, for the site's own code to place anywhere:
6
+ * a footer promo, a sidebar, a page of its own. Pop-ups and menu dropdowns are already drawn by the layout.
7
+ *
8
+ * import { GlobalBlock } from "@/hearth/blocks/global";
9
+ * <GlobalBlock name="newsletter" />
10
+ *
11
+ * Draws nothing until it's published; while previewing, it shows the draft. `hearthNext.getGlobalBlocks()` lists them all.
12
+ */
13
+ export async function GlobalBlock({ name }: { name: string }) {
14
+ const global = await hearthNext.getGlobalBlock(name);
15
+ return global ? <Blocks blocks={[global.block]} /> : null;
16
+ }