@the-smithy/hearth 0.24.1 → 0.25.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/dist/next.d.ts +1 -1
- package/dist/next.js +4 -4
- package/dist/testing.js +2 -1
- package/llms.md +1 -0
- package/package.json +2 -2
package/dist/next.d.ts
CHANGED
|
@@ -254,7 +254,7 @@ declare function createHearthNext(client: HearthCore, { tag, revalidate }?: Hear
|
|
|
254
254
|
sitemap(): Promise<MetadataRoute.Sitemap>;
|
|
255
255
|
/**
|
|
256
256
|
* Hearth's sitemap plus pages the site's own code serves (an events calendar, a donate page), skipping any
|
|
257
|
-
* Hearth already lists:
|
|
257
|
+
* Hearth already lists and any that a page in Hearth at that address hides from search engines:
|
|
258
258
|
* export default hearthNext.sitemapWith(["/events", "/fundraisers"]);
|
|
259
259
|
*/
|
|
260
260
|
sitemapWith(paths: string[]): () => Promise<MetadataRoute.Sitemap>;
|
package/dist/next.js
CHANGED
|
@@ -276,15 +276,15 @@ function createHearthNext(client, { tag = "hearth", revalidate = 3600 } = {}) {
|
|
|
276
276
|
},
|
|
277
277
|
/**
|
|
278
278
|
* Hearth's sitemap plus pages the site's own code serves (an events calendar, a donate page), skipping any
|
|
279
|
-
* Hearth already lists:
|
|
279
|
+
* Hearth already lists and any that a page in Hearth at that address hides from search engines:
|
|
280
280
|
* export default hearthNext.sitemapWith(["/events", "/fundraisers"]);
|
|
281
281
|
*/
|
|
282
282
|
sitemapWith(paths) {
|
|
283
283
|
return async () => {
|
|
284
|
-
const [entries, site] = await Promise.all([client.sitemap(tags(`${tag}:pages`, `${tag}:events`)), client.site.get(tags(`${tag}:site`))]);
|
|
284
|
+
const [entries, site, pages] = await Promise.all([client.sitemap(tags(`${tag}:pages`, `${tag}:events`)), client.site.get(tags(`${tag}:site`)), client.pages.list(tags(`${tag}:pages`))]);
|
|
285
285
|
const base = siteBaseUrl(site) ?? "";
|
|
286
|
-
const
|
|
287
|
-
const extra = site.settings.seo.noIndex ? [] : paths.filter((p) => !
|
|
286
|
+
const skip = /* @__PURE__ */ new Set([...entries.map((e) => e.path), ...pages.filter((p) => p.noIndex).map((p) => p.path)]);
|
|
287
|
+
const extra = site.settings.seo.noIndex ? [] : paths.filter((p) => !skip.has(p)).map((p) => ({ url: `${base}${p}`, priority: 0.6 }));
|
|
288
288
|
return [...entries.map((e) => ({ url: e.url, ...e.lastModified ? { lastModified: e.lastModified } : {}, priority: e.priority })), ...extra];
|
|
289
289
|
};
|
|
290
290
|
},
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/testing.ts
|
|
2
|
+
import { isUnlistedPage } from "@the-smithy/hearth-schema";
|
|
2
3
|
var json = (body, status = 200) => new Response(JSON.stringify(body), { status, headers: { "Content-Type": "application/json" } });
|
|
3
4
|
var notFound = () => json({ error: { code: "not_found", message: "Not found" } }, 404);
|
|
4
5
|
function createMockHearth(data = {}) {
|
|
@@ -30,7 +31,7 @@ function createMockHearth(data = {}) {
|
|
|
30
31
|
return result.ok ? json({ data: { message: result.message } }, 201) : json({ error: { code: "bad_request", message: result.message, details: result.fieldErrors } }, 400);
|
|
31
32
|
}
|
|
32
33
|
if (rest === "") return json({ data: { slug, name: slug, domain: null, features: [], settings: {}, ...data.site } });
|
|
33
|
-
if (rest === "/pages") return json({ data: (data.pages ?? []).map(({ slug: slug2, path, title, seo, publishedAt }) => ({ slug: slug2, path, title, seo, noIndex:
|
|
34
|
+
if (rest === "/pages") return json({ data: (data.pages ?? []).map(({ slug: slug2, path, title, seo, publishedAt }) => ({ slug: slug2, path, title, seo, noIndex: Boolean(seo?.noIndex) || isUnlistedPage(slug2), publishedAt })) });
|
|
34
35
|
if (rest.startsWith("/pages/")) {
|
|
35
36
|
const pool = req.headers.get("x-hearth-preview") ? [...data.draftPages ?? [], ...data.pages ?? []] : data.pages ?? [];
|
|
36
37
|
const page = pool.find((p) => p.slug === decodeURIComponent(rest.slice(7)));
|
package/llms.md
CHANGED
|
@@ -62,6 +62,7 @@ client components: the API key is secret.
|
|
|
62
62
|
- `PageMeta`: `fullTitle`, `title`, `description`, `canonical`, `robots { index, follow }`,
|
|
63
63
|
`openGraph`, `twitter`, `image { url, width, height, alt }`, `jsonLd[]`.
|
|
64
64
|
- Each block is `{ id, type, data }`; fields live on `data`. Narrow by `type`; use `BlockOf<"hero">` for one type.
|
|
65
|
+
- Any block may have `anchor` (beside `type`): make it the `id` of its outermost element, so `/#anchor` links reach it.
|
|
65
66
|
- Unknown future types arrive as `UnknownBlock`. Always handle a fallback.
|
|
66
67
|
- Images are `ImageRef = { src, alt, width?, height?, focal?: { x, y } }`. `focal` is the spot to keep in view when the
|
|
67
68
|
image is cropped (percentages across and down, set in Hearth's media library). For an image with `object-fit: cover`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-smithy/hearth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Typed client for the Hearth Delivery API: content, SEO, forms and publish webhooks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"llms.md"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@the-smithy/hearth-schema": "^0.
|
|
52
|
+
"@the-smithy/hearth-schema": "^0.25.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"next": ">=15",
|