@jdevalk/seo-graph-core 0.1.0-alpha.0 → 0.2.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
@@ -2,27 +2,109 @@
2
2
 
3
3
  Pure schema.org JSON-LD graph builders. Runtime-agnostic core for agent-ready SEO.
4
4
 
5
- > **Status:** pre-v1, scaffolding phase. No stable API yet. See the
6
- > [roadmap](https://github.com/jdevalk/seo-graph#roadmap) in the monorepo root.
5
+ > **Status:** `0.1.0` (pre-1.0). The API works and has three real consumers
6
+ > in production, but a few known warts (listed below) will be smoothed out in
7
+ > `0.2.x` without breaking changes before a stable `1.0`.
7
8
 
8
9
  ## What this is
9
10
 
10
- A small, dependency-light library that builds a valid schema.org `@graph` from
11
- a set of typed inputs. It does one thing: turn structured page data into
12
- byte-correct JSON-LD that search engines and agents can consume.
11
+ A small, dependency-light library that builds a valid schema.org `@graph`
12
+ from a set of typed inputs. It does one thing: turn structured page data
13
+ into byte-correct JSON-LD that search engines and agents can consume.
13
14
 
14
- It does **not** know anything about Astro, Next.js, EmDash, WordPress, or any
15
- other runtime. Use `@jdevalk/astro-seo-graph` for the Astro integration, or
16
- consume this directly from your own CMS/framework.
15
+ It does **not** know anything about Astro, Next.js, EmDash, WordPress, or
16
+ any other runtime. Use [`@jdevalk/astro-seo-graph`](https://www.npmjs.com/package/@jdevalk/astro-seo-graph)
17
+ for the Astro integration, or consume this directly from your own CMS or
18
+ framework.
19
+
20
+ ## Install
21
+
22
+ ```sh
23
+ npm install @jdevalk/seo-graph-core
24
+ ```
25
+
26
+ ## What you get
27
+
28
+ | API | Purpose |
29
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
30
+ | `makeIds({ siteUrl, personUrl? })` | `IdFactory` for stable `@id` references across site-wide and per-page entities. |
31
+ | `assembleGraph(pieces)` | Wraps pieces in a `{ @context, @graph }` envelope with first-wins deduplication by `@id`. |
32
+ | `deduplicateByGraphId(entities)` | The dedup engine on its own, in case you need custom assembly. |
33
+ | `buildArticle`, `buildWebPage`, `buildWebSite`, `buildBreadcrumbList`, `buildImageObject`, `buildPerson`, `buildOrganization`, `buildVideoObject`, `buildSiteNavigationElement`, `buildCustomPiece` | Piece builders. All return schema-dts typed objects. |
34
+
35
+ ## Usage
36
+
37
+ ```ts
38
+ import {
39
+ makeIds,
40
+ assembleGraph,
41
+ buildWebSite,
42
+ buildArticle,
43
+ buildWebPage,
44
+ buildBreadcrumbList,
45
+ } from '@jdevalk/seo-graph-core';
46
+
47
+ const ids = makeIds({ siteUrl: 'https://example.com' });
48
+ const url = 'https://example.com/my-post/';
49
+
50
+ const graph = assembleGraph([
51
+ buildWebSite(
52
+ {
53
+ url: 'https://example.com/',
54
+ name: 'Example',
55
+ publisher: { '@id': ids.person },
56
+ },
57
+ ids,
58
+ ),
59
+ buildWebPage(
60
+ {
61
+ url,
62
+ name: 'My Post',
63
+ isPartOf: { '@id': ids.website },
64
+ breadcrumb: { '@id': ids.breadcrumb(url) },
65
+ datePublished: new Date('2026-04-07'),
66
+ },
67
+ ids,
68
+ ),
69
+ buildArticle(
70
+ {
71
+ url,
72
+ isPartOf: { '@id': ids.webPage(url) },
73
+ author: { '@id': ids.person },
74
+ publisher: { '@id': ids.person },
75
+ headline: 'My Post',
76
+ description: '…',
77
+ datePublished: new Date('2026-04-07'),
78
+ },
79
+ ids,
80
+ ),
81
+ buildBreadcrumbList(
82
+ {
83
+ url,
84
+ items: [
85
+ { name: 'Home', url: 'https://example.com/' },
86
+ { name: 'My Post', url },
87
+ ],
88
+ },
89
+ ids,
90
+ ),
91
+ ]);
92
+
93
+ // graph === { '@context': 'https://schema.org', '@graph': [...] }
94
+ ```
17
95
 
18
96
  ## Why
19
97
 
20
98
  The [agent-ready web](https://joost.blog/tag/agent-ready/) needs every
21
99
  publisher to expose a rich, linked knowledge graph for their content. Hand-
22
100
  writing JSON-LD is error-prone; writing it once per framework is worse.
23
- `@jdevalk/seo-graph-core` is the shared core that two real consumers — this
24
- blog (Astro) and [`@jdevalk/emdash-plugin-seo`](https://www.npmjs.com/package/@jdevalk/emdash-plugin-seo)
25
- (EmDash CMS) — will both depend on, so the graph they emit stays consistent.
101
+ `@jdevalk/seo-graph-core` is the shared engine behind two downstream packages,
102
+ both in production:
103
+
104
+ - [`@jdevalk/astro-seo-graph`](https://www.npmjs.com/package/@jdevalk/astro-seo-graph) — the Astro integration (`<Seo>` + route factories). Used in production by [joost.blog](https://joost.blog) and [limonaia.house](https://limonaia.house).
105
+ - [`@jdevalk/emdash-plugin-seo`](https://www.npmjs.com/package/@jdevalk/emdash-plugin-seo) — the EmDash CMS plugin. Uses `assembleGraph` directly (EmDash contributes metadata through hooks, not through templates, so it doesn't go through the `<Seo>` component).
106
+
107
+ Two different integration runtimes, one graph engine.
26
108
 
27
109
  ## License
28
110
 
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/pieces/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,SAAS,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/pieces/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,gBAAgB;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBjG"}
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/pieces/image.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC5B,KAAuB,EACvB,GAAc;IAEd,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnG,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,KAAK,GAA4B;QACnC,OAAO,EAAE,aAAa;QACtB,KAAK,EAAE,EAAE;QACT,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,UAAU,EAAE,KAAK,CAAC,GAAG;QACrB,KAAK,EAAE,KAAK,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@
1
+ import type { Organization } from 'schema-dts';
1
2
  import type { IdFactory } from '../ids.js';
2
- export interface OrganizationInput {
3
+ export interface OrganizationInput<T extends Organization = Organization> {
3
4
  /** Stable slug used for the @id. */
4
5
  slug: string;
5
6
  name: string;
@@ -10,24 +11,36 @@ export interface OrganizationInput {
10
11
  '@id': string;
11
12
  };
12
13
  sameAs?: readonly string[];
13
- /** Escape hatch for schema.org properties specific to a subtype. */
14
- extra?: Record<string, unknown>;
14
+ /**
15
+ * Escape hatch for schema.org properties specific to a subtype. Typed
16
+ * as `Partial<T>` so callers that pass a concrete subtype (e.g.
17
+ * `OrganizationInput<Hotel>`) get schema-dts autocomplete for that
18
+ * subtype's fields — `checkinTime`, `numberOfRooms`, etc. — instead
19
+ * of an untyped `Record<string, unknown>`.
20
+ */
21
+ extra?: Partial<T>;
15
22
  }
16
23
  /**
17
24
  * Build a schema.org Organization piece, or any of its subtypes. Pass the
18
- * concrete @type as the third argument to set the subtype:
25
+ * concrete @type as the third argument and the matching schema-dts type as
26
+ * the generic parameter to get autocomplete for that subtype's fields:
19
27
  *
20
28
  * ```ts
21
29
  * import type { Hotel } from 'schema-dts';
22
30
  * const hotel = buildOrganization<Hotel>(
23
- * { slug: 'la-limonaia', name: 'La Limonaia', extra: { checkinTime: '16:00' } },
31
+ * {
32
+ * slug: 'la-limonaia',
33
+ * name: 'La Limonaia',
34
+ * extra: { checkinTime: '16:00' }, // <-- typed against Hotel
35
+ * },
24
36
  * ids,
25
37
  * 'Hotel',
26
38
  * );
27
39
  * ```
28
40
  *
29
- * The generic type parameter is advisory it flows schema-dts autocomplete
30
- * into the `extra` field at call sites when you give it a concrete subtype.
41
+ * The generic defaults to `Organization`, so call sites that don't need
42
+ * subtype typing (`buildOrganization({ slug, name }, ids)`) continue to
43
+ * work without specifying `<T>`.
31
44
  */
32
- export declare function buildOrganization(input: OrganizationInput, ids: IdFactory, subtype?: string): Record<string, unknown>;
45
+ export declare function buildOrganization<T extends Organization = Organization>(input: OrganizationInput<T>, ids: IdFactory, subtype?: string): Record<string, unknown>;
33
46
  //# sourceMappingURL=organization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../src/pieces/organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,iBAAiB;IAC9B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,SAAS,EACd,OAAO,GAAE,MAAuB,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../src/pieces/organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACpE,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EACnE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC3B,GAAG,EAAE,SAAS,EACd,OAAO,GAAE,MAAuB,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
@@ -1,18 +1,24 @@
1
1
  /**
2
2
  * Build a schema.org Organization piece, or any of its subtypes. Pass the
3
- * concrete @type as the third argument to set the subtype:
3
+ * concrete @type as the third argument and the matching schema-dts type as
4
+ * the generic parameter to get autocomplete for that subtype's fields:
4
5
  *
5
6
  * ```ts
6
7
  * import type { Hotel } from 'schema-dts';
7
8
  * const hotel = buildOrganization<Hotel>(
8
- * { slug: 'la-limonaia', name: 'La Limonaia', extra: { checkinTime: '16:00' } },
9
+ * {
10
+ * slug: 'la-limonaia',
11
+ * name: 'La Limonaia',
12
+ * extra: { checkinTime: '16:00' }, // <-- typed against Hotel
13
+ * },
9
14
  * ids,
10
15
  * 'Hotel',
11
16
  * );
12
17
  * ```
13
18
  *
14
- * The generic type parameter is advisory it flows schema-dts autocomplete
15
- * into the `extra` field at call sites when you give it a concrete subtype.
19
+ * The generic defaults to `Organization`, so call sites that don't need
20
+ * subtype typing (`buildOrganization({ slug, name }, ids)`) continue to
21
+ * work without specifying `<T>`.
16
22
  */
17
23
  export function buildOrganization(input, ids, subtype = 'Organization') {
18
24
  const piece = {
@@ -1 +1 @@
1
- {"version":3,"file":"organization.js","sourceRoot":"","sources":["../../src/pieces/organization.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAC7B,K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C,IAAI,KAAK,SAAS;QAAE,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5D,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/pieces/video.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC7B;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,QAAQ,EAAE,SAAS,CAAC;IACpB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,SAAS,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzB"}
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../src/pieces/video.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,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AAC,CAAC,8BAA8B,KAAK,CAAC,SAAS,oBAAoB;YACnE,CAAC,CAAC,SAAS,CAAC,CAAC;IACrB,IAAI,SAAS,KAAK,SAAS;QAAE,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;IAE5D,MAAM,KAAK,GACP,KAAK,CAAC,QAAQ;QACd,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS;YAC1B,CAAC,CAAC,0CAA0C,KAAK,CAAC,SAAS,EAAE;YAC7D,CAAC,CAAC,SAAS,CAAC,CAAC;IACrB,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;IAEhD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IACtF,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;QAAE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;IAClE,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS;QAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IAExE,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
@@ -12,8 +12,13 @@ export interface WebPageInput {
12
12
  name: string;
13
13
  /** Reference to the site-wide WebSite (usually ids.website). */
14
14
  isPartOf: Reference;
15
- /** Reference to the BreadcrumbList for this page (usually ids.breadcrumb(url)). */
16
- breadcrumb: Reference;
15
+ /**
16
+ * Reference to the BreadcrumbList for this page (usually
17
+ * `ids.breadcrumb(url)`). Optional — schema.org treats `breadcrumb`
18
+ * as optional on `WebPage`, so consumers without breadcrumbs can
19
+ * simply omit it.
20
+ */
21
+ breadcrumb?: Reference;
17
22
  inLanguage?: string;
18
23
  /** Publish date — emitted as ISO string. */
19
24
  datePublished?: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"webpage.d.ts","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEvE,MAAM,WAAW,YAAY;IACzB,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,EAAE,SAAS,CAAC;IACpB,mFAAmF;IACnF,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,oDAAoD;IACpD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,WAAuB,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8BzB"}
1
+ {"version":3,"file":"webpage.d.ts","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEvE,MAAM,WAAW,YAAY;IACzB,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,oDAAoD;IACpD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CACxB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,WAAuB,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgCzB"}
@@ -16,10 +16,12 @@ export function buildWebPage(input, ids, type = 'WebPage') {
16
16
  url: input.url,
17
17
  name: input.name,
18
18
  isPartOf: input.isPartOf,
19
- breadcrumb: input.breadcrumb,
20
19
  inLanguage: input.inLanguage ?? 'en-US',
21
20
  potentialAction,
22
21
  };
22
+ if (input.breadcrumb !== undefined) {
23
+ piece.breadcrumb = input.breadcrumb;
24
+ }
23
25
  if (input.datePublished !== undefined) {
24
26
  piece.datePublished = input.datePublished.toISOString();
25
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webpage.js","sourceRoot":"","sources":["../../src/pieces/webpage.ts"],"names":[],"mappings":"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CAAC,KAAK,EAAE,CAAC;AACxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jdevalk/seo-graph-core",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.2.0",
4
4
  "description": "Pure schema.org JSON-LD graph builders. Runtime-agnostic core for agent-ready SEO.",
5
5
  "keywords": [
6
6
  "schema.org",