@jdevalk/astro-seo-graph 0.3.0 → 0.4.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/AGENTS.md +3078 -0
- package/README.md +13 -14
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -6,21 +6,20 @@ content-collection aggregator, breadcrumb helpers, and Zod helpers for content
|
|
|
6
6
|
schemas.
|
|
7
7
|
|
|
8
8
|
For detailed usage — including all builder signatures, site-type recipes, and
|
|
9
|
-
schema.org best practices — see [AGENTS.md](
|
|
10
|
-
root.
|
|
9
|
+
schema.org best practices — see [AGENTS.md](https://github.com/jdevalk/seo-graph/blob/main/AGENTS.md).
|
|
11
10
|
|
|
12
11
|
## What you get
|
|
13
12
|
|
|
14
|
-
| API
|
|
15
|
-
|
|
16
|
-
| **`<Seo>`** (`./Seo.astro`)
|
|
17
|
-
| **`createSchemaEndpoint`**
|
|
18
|
-
| **`createSchemaMap`**
|
|
19
|
-
| **`aggregate`**
|
|
20
|
-
| **`seoSchema`, `imageSchema`** | Zod schemas for the `seo` and `image` fields on content collections. Import them into `src/content.config.ts`.
|
|
21
|
-
| **`buildAstroSeoProps`**
|
|
22
|
-
| **`buildAlternateLinks`**
|
|
23
|
-
| **`breadcrumbsFromUrl`**
|
|
13
|
+
| API | Purpose |
|
|
14
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| **`<Seo>`** (`./Seo.astro`) | Single head component covering `<title>`, meta description, canonical, Open Graph, Twitter card, hreflang alternates, and optional JSON-LD `@graph`. Wraps [`astro-seo`](https://github.com/jonasmerlin/astro-seo) for the meta tags. |
|
|
16
|
+
| **`createSchemaEndpoint`** | Factory returning an Astro `APIRoute` handler that serves a corpus-wide JSON-LD `@graph` for a content collection. |
|
|
17
|
+
| **`createSchemaMap`** | Factory returning an `APIRoute` handler that emits a sitemap-style XML listing of your site's schema endpoints — the discovery point for agent crawlers. |
|
|
18
|
+
| **`aggregate`** | Shared engine behind the endpoint factories. Walks a list of entries, runs a caller-supplied mapper, deduplicates by `@id`. |
|
|
19
|
+
| **`seoSchema`, `imageSchema`** | Zod schemas for the `seo` and `image` fields on content collections. Import them into `src/content.config.ts`. |
|
|
20
|
+
| **`buildAstroSeoProps`** | Pure-TS logic that powers `<Seo>` — exported for users who want to feed a different head component. |
|
|
21
|
+
| **`buildAlternateLinks`** | Pure helper that turns a `{ hreflang, href }` entry list into normalized `<link rel="alternate">` tags plus an `x-default`. Used internally by `<Seo>`'s `alternates` prop, and exported for non-Astro callers (e.g. CMS plugins feeding their own metadata pipelines). |
|
|
22
|
+
| **`breadcrumbsFromUrl`** | Derives a breadcrumb trail from an Astro URL. Splits path segments, supports custom display names and segment skipping. Returns `BreadcrumbItem[]` ready to pass to `buildBreadcrumbList`. |
|
|
24
23
|
|
|
25
24
|
## Installation
|
|
26
25
|
|
|
@@ -86,9 +85,9 @@ const ids = makeIds({ siteUrl: 'https://example.com' });
|
|
|
86
85
|
const url = 'https://example.com/blog/open-source/my-post/';
|
|
87
86
|
|
|
88
87
|
const items = breadcrumbsFromUrl({
|
|
89
|
-
url: Astro.url,
|
|
88
|
+
url: Astro.url, // or any URL / string
|
|
90
89
|
siteUrl: 'https://example.com',
|
|
91
|
-
pageName: 'My Post',
|
|
90
|
+
pageName: 'My Post', // display name for the current page
|
|
92
91
|
// homeName: 'Home', // optional, defaults to 'Home'
|
|
93
92
|
// names: { blog: 'Articles' }, // optional, custom segment names
|
|
94
93
|
// skip: ['category'], // optional, segments to omit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdevalk/astro-seo-graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Astro integration for @jdevalk/seo-graph-core. Seo component, route factories, content-collection aggregator, Zod content helpers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
29
29
|
"README.md",
|
|
30
|
+
"AGENTS.md",
|
|
30
31
|
"LICENSE"
|
|
31
32
|
],
|
|
32
33
|
"repository": {
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"astro-seo": "^1.1.0",
|
|
47
48
|
"schema-dts": "^2.0.0",
|
|
48
49
|
"zod": "^3.24.0",
|
|
49
|
-
"@jdevalk/seo-graph-core": "0.
|
|
50
|
+
"@jdevalk/seo-graph-core": "0.5.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@types/node": "^22.0.0",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"vitest": "^2.0.0"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
|
-
"build": "tsc -p tsconfig.build.json && mkdir -p dist/components && cp src/components/*.astro dist/components/",
|
|
59
|
+
"build": "tsc -p tsconfig.build.json && mkdir -p dist/components && cp src/components/*.astro dist/components/ && cp ../../AGENTS.md .",
|
|
59
60
|
"typecheck": "tsc -p tsconfig.json",
|
|
60
61
|
"test": "vitest run"
|
|
61
62
|
}
|