@the-smithy/create-hearth-site 0.13.1 → 0.14.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/README.md
CHANGED
|
@@ -38,7 +38,7 @@ The command copies the starter into the new folder, writes `.env.local` with the
|
|
|
38
38
|
cd acme-website
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Add an API key to `.env.local` (Hearth → the site →
|
|
41
|
+
Add an API key to `.env.local` (Hearth → the site → API & webhooks → API keys), and run `pnpm dev`. The
|
|
42
42
|
new site's README walks through the first run, previews, deploying and troubleshooting.
|
|
43
43
|
|
|
44
44
|
## Documentation
|
|
@@ -111,7 +111,7 @@ Created ${pkg.name} in ${rel}.
|
|
|
111
111
|
|
|
112
112
|
Next:
|
|
113
113
|
cd ${rel}
|
|
114
|
-
${installed ? "" : " pnpm install\n"} Add an API key to .env.local as HEARTH_API_KEY (Hearth → the site →
|
|
114
|
+
${installed ? "" : " pnpm install\n"} Add an API key to .env.local as HEARTH_API_KEY (Hearth → the site → API & webhooks → API keys)${
|
|
115
115
|
site ? "" : "\n Set HEARTH_SITE in .env.local to the site's address in Hearth (after /admin/sites/ in its address bar)"
|
|
116
116
|
}
|
|
117
117
|
pnpm dev, then open http://localhost:3000
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-smithy/create-hearth-site",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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.
|
|
32
|
+
"@the-smithy/hearth-schema": "^0.14.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"test": "node --test \"test/**/*.test.js\" && vitest run test/blocks.test.ts"
|
package/template/.env.example
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# The site's address in Hearth: the part after /admin/sites/ in Hearth's address bar, e.g. grand-eastonian.
|
|
2
2
|
HEARTH_SITE=
|
|
3
|
-
# A Delivery API key: Hearth → the site →
|
|
3
|
+
# A Delivery API key: Hearth → the site → API & webhooks → API keys. Secret: server-side only.
|
|
4
4
|
HEARTH_API_KEY=
|
|
5
|
-
# Only once deployed: the Signing secret shown after saving the Revalidation webhook (
|
|
5
|
+
# Only once deployed: the Signing secret shown after saving the Revalidation webhook (API & webhooks).
|
|
6
6
|
HEARTH_WEBHOOK_SECRET=
|
|
7
7
|
# Optional: point at a different Hearth (e.g. a staging deploy).
|
|
8
8
|
# HEARTH_BASE_URL=https://hearth.thesmithy.io
|
package/template/README.md
CHANGED
|
@@ -13,7 +13,7 @@ look; Hearth decides what's on the page.** Editors change content in Hearth, and
|
|
|
13
13
|
|
|
14
14
|
## First run
|
|
15
15
|
|
|
16
|
-
1. **Create an API key.** In Hearth, open the site, then **
|
|
16
|
+
1. **Create an API key.** In Hearth, open the site, then **API & webhooks → API keys** (in the sidebar), and create a key
|
|
17
17
|
(name it after where it's used, e.g. "Local"). Copy it straight away: it's only shown once.
|
|
18
18
|
2. **Add it to `.env.local`** in this folder:
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ look; Hearth decides what's on the page.** Editors change content in Hearth, and
|
|
|
29
29
|
4. **Publish something in Hearth.** The site only shows **published** content, so a site whose pages are all
|
|
30
30
|
drafts shows "Page not found" everywhere. That's expected, not a bug. Ask the site's editors to publish the
|
|
31
31
|
homepage (its address is `home`), or publish it yourself if you have edit access, then reload.
|
|
32
|
-
5. **Optional: preview drafts on your machine.** In **
|
|
32
|
+
5. **Optional: preview drafts on your machine.** In **API & webhooks → Webhook and preview**, set
|
|
33
33
|
**Preview address** to `http://localhost:3000/api/preview`. "Preview on the website" in Hearth's editor then
|
|
34
34
|
opens your local site with drafts showing, refreshing as you edit. This applies to everyone previewing that
|
|
35
35
|
site, so clear it when you're done.
|
|
@@ -97,7 +97,7 @@ Do these in order: the webhook's signing secret only exists once the webhook URL
|
|
|
97
97
|
3. **Deploy**, and note the site's domain.
|
|
98
98
|
4. **Set the web address in Hearth.** The site's admin sets it under **Settings → Your site → Web address**.
|
|
99
99
|
Until then, search engines are kept out.
|
|
100
|
-
5. **Connect the publish webhook.** In **
|
|
100
|
+
5. **Connect the publish webhook.** In **API & webhooks → Webhook and preview**, set **Revalidation
|
|
101
101
|
webhook** to `https://<domain>/api/revalidate` and save. A **Signing secret** appears: add it in Netlify as
|
|
102
102
|
`HEARTH_WEBHOOK_SECRET`, then **redeploy**, since Netlify only applies new variables on the next deploy.
|
|
103
103
|
6. **Clear the Preview address** if you set it to localhost. Empty means the live site's `/api/preview`.
|
|
@@ -115,7 +115,7 @@ Without the webhook, published changes still appear, but can take up to an hour.
|
|
|
115
115
|
| An `unauthorized` (401) error from Hearth | The key is mistyped, revoked, or belongs to another site. Create a new one for this site |
|
|
116
116
|
| Published changes don't show locally | Hard refresh (Ctrl+Shift+R). The webhook can't reach your computer |
|
|
117
117
|
| Published changes don't show live | The webhook isn't set, or `HEARTH_WEBHOOK_SECRET` doesn't match Hearth's signing secret (redeploy after changing it) |
|
|
118
|
-
| "Preview on the website" opens the wrong place | Check **Preview address** in
|
|
118
|
+
| "Preview on the website" opens the wrong place | Check **Preview address** in API & webhooks |
|
|
119
119
|
|
|
120
120
|
## Documentation
|
|
121
121
|
|
|
@@ -21,8 +21,8 @@ function readEnv() {
|
|
|
21
21
|
.map(([, key, value]) => [key, value.replace(/^["']|["']$/g, "").replace(/\s+#.*$/, "")]),
|
|
22
22
|
);
|
|
23
23
|
if (!env.HEARTH_SITE) fail("HEARTH_SITE is empty in .env.local. It's the site's address: the part after /admin/sites/ in Hearth's address bar.");
|
|
24
|
-
if (!env.HEARTH_API_KEY) fail("HEARTH_API_KEY is empty in .env.local. Create a key in Hearth → the site →
|
|
25
|
-
if (!env.HEARTH_API_KEY.startsWith("hk_")) fail("HEARTH_API_KEY doesn't look like a Hearth key (they start with hk_). Copy it again from
|
|
24
|
+
if (!env.HEARTH_API_KEY) fail("HEARTH_API_KEY is empty in .env.local. Create a key in Hearth → the site → API & webhooks → API keys.");
|
|
25
|
+
if (!env.HEARTH_API_KEY.startsWith("hk_")) fail("HEARTH_API_KEY doesn't look like a Hearth key (they start with hk_). Copy it again from API & webhooks.");
|
|
26
26
|
return { site: env.HEARTH_SITE, apiKey: env.HEARTH_API_KEY, baseUrl: (env.HEARTH_BASE_URL || DEFAULT_BASE_URL).replace(/\/+$/, "") };
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -2,9 +2,9 @@ import Link from "next/link";
|
|
|
2
2
|
import type { Site } from "@the-smithy/hearth";
|
|
3
3
|
import { Img, SmartLink } from "@/components/ui";
|
|
4
4
|
|
|
5
|
-
/** Logo, menu and announcement banner, all edited in Hearth (Settings → General and Navigation). */
|
|
5
|
+
/** Logo, menu, menu button and announcement banner, all edited in Hearth (Settings → General, and Navigation). */
|
|
6
6
|
export function SiteHeader({ site }: { site: Site }) {
|
|
7
|
-
const { announcement, seo, tagline, navigation } = site.settings;
|
|
7
|
+
const { announcement, seo, tagline, navigation, navigationCta } = site.settings;
|
|
8
8
|
return (
|
|
9
9
|
<header className="border-b border-line bg-bg">
|
|
10
10
|
{announcement ? <p className="bg-accent px-4 py-2 text-center text-sm font-semibold text-accent-ink">{announcement}</p> : null}
|
|
@@ -16,13 +16,19 @@ export function SiteHeader({ site }: { site: Site }) {
|
|
|
16
16
|
{tagline ? <span className="text-sm font-normal text-muted-ink">{tagline}</span> : null}
|
|
17
17
|
</span>
|
|
18
18
|
</Link>
|
|
19
|
-
{navigation.length ? (
|
|
19
|
+
{navigation.length || navigationCta ? (
|
|
20
20
|
<nav aria-label="Main" className="flex flex-wrap items-center gap-x-6 gap-y-1 font-medium">
|
|
21
21
|
{navigation.map((item) => (
|
|
22
22
|
<SmartLink key={item.href + item.label} href={item.href} className="py-2 hover:text-highlight">
|
|
23
23
|
{item.label}
|
|
24
24
|
</SmartLink>
|
|
25
25
|
))}
|
|
26
|
+
{/* The menu button (Navigation → Menu button in Hearth): one action that stands out from the links. */}
|
|
27
|
+
{navigationCta ? (
|
|
28
|
+
<SmartLink href={navigationCta.href} className="rounded-lg bg-accent px-4 py-2 font-semibold text-accent-ink hover:opacity-90">
|
|
29
|
+
{navigationCta.label}
|
|
30
|
+
</SmartLink>
|
|
31
|
+
) : null}
|
|
26
32
|
</nav>
|
|
27
33
|
) : null}
|
|
28
34
|
</div>
|