starlight-seo 0.2.0 → 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 +14 -0
- package/README.md +8 -6
- package/README.ru.md +8 -6
- package/lib/page.js +3 -3
- package/lib/text.js +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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
|
+
|
|
11
|
+
## [0.2.1] - 2026-10-05
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- The package is published to npm as `starlight-seo`; the install commands use the registry instead of a git tag.
|
|
16
|
+
|
|
5
17
|
## [0.2.0] - 2026-10-05
|
|
6
18
|
|
|
7
19
|
### Added
|
|
@@ -33,5 +45,7 @@ All notable changes to this project are documented here. The format follows [Kee
|
|
|
33
45
|
- Build audit with 14 rules that fails the build on errors.
|
|
34
46
|
- Per-language values for every text option.
|
|
35
47
|
|
|
48
|
+
[0.2.2]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.2.2
|
|
49
|
+
[0.2.1]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.2.1
|
|
36
50
|
[0.2.0]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.2.0
|
|
37
51
|
[0.1.0]: https://github.com/kaktaknet/starlight-seo/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
**Search-ready titles, connected JSON-LD, complete Open Graph tags and a build-time SEO audit for [Starlight](https://starlight.astro.build/) documentation sites.**
|
|
6
6
|
|
|
7
7
|
[](https://github.com/kaktaknet/starlight-seo/actions/workflows/ci.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/starlight-seo)
|
|
8
9
|
[](https://github.com/kaktaknet/starlight-seo/tags)
|
|
9
10
|
[](./LICENSE)
|
|
10
11
|
[](https://starlight.astro.build/)
|
|
@@ -38,12 +39,13 @@
|
|
|
38
39
|
The sidebar still says **Git**. The `<h1>` still says **Git**.
|
|
39
40
|
|
|
40
41
|
<details>
|
|
41
|
-
<summary><b>For AI agents: the whole repository in
|
|
42
|
+
<summary><b>For AI agents: the whole repository in fifteen lines</b></summary>
|
|
42
43
|
|
|
43
44
|
```text
|
|
44
45
|
package starlight-seo (ESM, plain JavaScript + hand-written .d.ts, zero dependencies)
|
|
45
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
|
|
46
|
-
|
|
47
|
+
npm https://www.npmjs.com/package/starlight-seo
|
|
48
|
+
install pnpm add starlight-seo -> plugins: [starlightSeo()] -> docsSchema({ extend: seoSchema() })
|
|
47
49
|
entry index.js default export starlightSeo(options) -> Starlight plugin
|
|
48
50
|
schema schema.js seoSchema() -> pass to docsSchema({ extend })
|
|
49
51
|
middleware middleware.js runs after Starlight, rewrites route.head, pushes JSON-LD
|
|
@@ -80,22 +82,22 @@ Working instructions for agents live in [AGENTS.md](./AGENTS.md).
|
|
|
80
82
|
|
|
81
83
|
## Install
|
|
82
84
|
|
|
83
|
-
The package is
|
|
85
|
+
The package is published on [npm](https://www.npmjs.com/package/starlight-seo).
|
|
84
86
|
|
|
85
87
|
### By hand
|
|
86
88
|
|
|
87
89
|
**1. Add the package.**
|
|
88
90
|
|
|
89
91
|
```sh
|
|
90
|
-
pnpm add
|
|
92
|
+
pnpm add starlight-seo
|
|
91
93
|
```
|
|
92
94
|
|
|
93
95
|
<details>
|
|
94
96
|
<summary>npm and yarn</summary>
|
|
95
97
|
|
|
96
98
|
```sh
|
|
97
|
-
npm install
|
|
98
|
-
yarn add starlight-seo
|
|
99
|
+
npm install starlight-seo
|
|
100
|
+
yarn add starlight-seo
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
</details>
|
package/README.ru.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
**Заголовки под поиск, связанный JSON-LD, полный набор Open Graph и проверка SEO при сборке для сайтов документации на [Starlight](https://starlight.astro.build/).**
|
|
6
6
|
|
|
7
7
|
[](https://github.com/kaktaknet/starlight-seo/actions/workflows/ci.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/starlight-seo)
|
|
8
9
|
[](https://github.com/kaktaknet/starlight-seo/tags)
|
|
9
10
|
[](./LICENSE)
|
|
10
11
|
[](https://starlight.astro.build/)
|
|
@@ -38,12 +39,13 @@
|
|
|
38
39
|
В меню по-прежнему **Git**. В `<h1>` по-прежнему **Git**.
|
|
39
40
|
|
|
40
41
|
<details>
|
|
41
|
-
<summary><b>Для ИИ-агентов: весь репозиторий в
|
|
42
|
+
<summary><b>Для ИИ-агентов: весь репозиторий в пятнадцати строках</b></summary>
|
|
42
43
|
|
|
43
44
|
```text
|
|
44
45
|
package starlight-seo (ESM, plain JavaScript + hand-written .d.ts, zero dependencies)
|
|
45
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
|
|
46
|
-
|
|
47
|
+
npm https://www.npmjs.com/package/starlight-seo
|
|
48
|
+
install pnpm add starlight-seo -> plugins: [starlightSeo()] -> docsSchema({ extend: seoSchema() })
|
|
47
49
|
entry index.js default export starlightSeo(options) -> Starlight plugin
|
|
48
50
|
schema schema.js seoSchema() -> pass to docsSchema({ extend })
|
|
49
51
|
middleware middleware.js runs after Starlight, rewrites route.head, pushes JSON-LD
|
|
@@ -80,22 +82,22 @@ tests pnpm test (node --test, unit) · pnpm test:fixture (builds tests/fi
|
|
|
80
82
|
|
|
81
83
|
## Установка
|
|
82
84
|
|
|
83
|
-
Пакет
|
|
85
|
+
Пакет опубликован в [npm](https://www.npmjs.com/package/starlight-seo).
|
|
84
86
|
|
|
85
87
|
### Вручную
|
|
86
88
|
|
|
87
89
|
**1. Добавьте пакет.**
|
|
88
90
|
|
|
89
91
|
```sh
|
|
90
|
-
pnpm add
|
|
92
|
+
pnpm add starlight-seo
|
|
91
93
|
```
|
|
92
94
|
|
|
93
95
|
<details>
|
|
94
96
|
<summary>npm и yarn</summary>
|
|
95
97
|
|
|
96
98
|
```sh
|
|
97
|
-
npm install
|
|
98
|
-
yarn add starlight-seo
|
|
99
|
+
npm install starlight-seo
|
|
100
|
+
yarn add starlight-seo
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
</details>
|
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