starlight-seo 0.2.1 → 0.2.2
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/CHANGELOG.md +7 -0
- package/README.md +2 -1
- package/README.ru.md +2 -1
- package/lib/page.js +3 -3
- package/lib/text.js +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [0.2.2] - 2026-10-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `site.about` given as one object (`{ name, url, sameAs }`) was read as a per-language map and reduced to its name; `url`, `sameAs` and `type` now reach the JSON-LD graph.
|
|
10
|
+
|
|
5
11
|
## [0.2.1] - 2026-10-05
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
@@ -39,6 +45,7 @@ All notable changes to this project are documented here. The format follows [Kee
|
|
|
39
45
|
- Build audit with 14 rules that fails the build on errors.
|
|
40
46
|
- Per-language values for every text option.
|
|
41
47
|
|
|
48
|
+
[0.2.2]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.2.2
|
|
42
49
|
[0.2.1]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.2.1
|
|
43
50
|
[0.2.0]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.2.0
|
|
44
51
|
[0.1.0]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
The sidebar still says **Git**. The `<h1>` still says **Git**.
|
|
40
40
|
|
|
41
41
|
<details>
|
|
42
|
-
<summary><b>For AI agents: the whole repository in
|
|
42
|
+
<summary><b>For AI agents: the whole repository in fifteen lines</b></summary>
|
|
43
43
|
|
|
44
44
|
```text
|
|
45
45
|
package starlight-seo (ESM, plain JavaScript + hand-written .d.ts, zero dependencies)
|
|
46
46
|
versions built for Starlight 0.42.x + Astro 7.x (tested 0.42.5 / 7.3.5); floor Starlight 0.32, Astro 5, Node 20
|
|
47
|
+
npm https://www.npmjs.com/package/starlight-seo
|
|
47
48
|
install pnpm add starlight-seo -> plugins: [starlightSeo()] -> docsSchema({ extend: seoSchema() })
|
|
48
49
|
entry index.js default export starlightSeo(options) -> Starlight plugin
|
|
49
50
|
schema schema.js seoSchema() -> pass to docsSchema({ extend })
|
package/README.ru.md
CHANGED
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
В меню по-прежнему **Git**. В `<h1>` по-прежнему **Git**.
|
|
40
40
|
|
|
41
41
|
<details>
|
|
42
|
-
<summary><b>Для ИИ-агентов: весь репозиторий в
|
|
42
|
+
<summary><b>Для ИИ-агентов: весь репозиторий в пятнадцати строках</b></summary>
|
|
43
43
|
|
|
44
44
|
```text
|
|
45
45
|
package starlight-seo (ESM, plain JavaScript + hand-written .d.ts, zero dependencies)
|
|
46
46
|
versions built for Starlight 0.42.x + Astro 7.x (tested 0.42.5 / 7.3.5); floor Starlight 0.32, Astro 5, Node 20
|
|
47
|
+
npm https://www.npmjs.com/package/starlight-seo
|
|
47
48
|
install pnpm add starlight-seo -> plugins: [starlightSeo()] -> docsSchema({ extend: seoSchema() })
|
|
48
49
|
entry index.js default export starlightSeo(options) -> Starlight plugin
|
|
49
50
|
schema schema.js seoSchema() -> pass to docsSchema({ extend })
|
package/lib/page.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { breadcrumbs } from './breadcrumbs.js'
|
|
2
2
|
import { isArticle } from './graph.js'
|
|
3
3
|
import { resolveTitle } from './title.js'
|
|
4
|
-
import { fill, firstMatch, pick } from './text.js'
|
|
4
|
+
import { fill, firstMatch, pick, pickThing } from './text.js'
|
|
5
5
|
|
|
6
6
|
const slugOf = (path) => path.replace(/^\/+|\/+$/g, '') || 'index'
|
|
7
7
|
|
|
@@ -55,7 +55,7 @@ export function resolvePage(options, input) {
|
|
|
55
55
|
modified: seo.modified ?? input.lastUpdated,
|
|
56
56
|
section: seo.section ?? rule?.section,
|
|
57
57
|
keywords: seo.keywords,
|
|
58
|
-
about: seo.about ??
|
|
58
|
+
about: seo.about ?? pickThing(options.site.about, lang, locale),
|
|
59
59
|
breadcrumbs: breadcrumbs({
|
|
60
60
|
sidebar: input.sidebar,
|
|
61
61
|
home,
|
|
@@ -69,7 +69,7 @@ export function resolvePage(options, input) {
|
|
|
69
69
|
name: siteName,
|
|
70
70
|
alternateName: pick(options.site.alternateName, lang, locale),
|
|
71
71
|
description: pick(options.site.description, lang, locale),
|
|
72
|
-
about:
|
|
72
|
+
about: pickThing(options.site.about, lang, locale),
|
|
73
73
|
},
|
|
74
74
|
}
|
|
75
75
|
}
|
package/lib/text.js
CHANGED
|
@@ -11,6 +11,14 @@ export const pick = (value, lang, locale) => {
|
|
|
11
11
|
return Object.values(value)[0]
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const THING_KEYS = ['name', 'url', 'sameAs', 'type', '@id', '@type']
|
|
15
|
+
|
|
16
|
+
export const pickThing = (value, lang, locale) => {
|
|
17
|
+
if (Array.isArray(value)) return value
|
|
18
|
+
if (value && typeof value === 'object' && THING_KEYS.some((key) => key in value)) return value
|
|
19
|
+
return pick(value, lang, locale)
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
export const fill = (template, values) =>
|
|
15
23
|
String(template).replace(/\{(\w+)\}/g, (whole, key) => (key in values ? String(values[key]) : whole))
|
|
16
24
|
|
package/package.json
CHANGED