@riebeckite/plugin-seo 0.0.12 → 0.0.13
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 +110 -110
- package/README_ja.md +68 -68
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
# @riebeckite/plugin-seo
|
|
2
|
-
|
|
3
|
-
SEO metadata, sitemap, robots.txt, and feed generation for Riebeckite.
|
|
4
|
-
|
|
5
|
-
[日本語](./README_ja.md)
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
`seo()` provides a `PluginSeoExtension` consumed by the Riebeckite app. It
|
|
10
|
-
builds per-page SEO metadata and renders `/sitemap.xml`, `/robots.txt`, and
|
|
11
|
-
RSS / Atom / JSON feeds.
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { defineConfig } from "@riebeckite/core";
|
|
17
|
-
import { seo } from "@riebeckite/plugin-seo";
|
|
18
|
-
|
|
19
|
-
export default defineConfig({
|
|
20
|
-
// ...
|
|
21
|
-
plugins: [
|
|
22
|
-
seo({
|
|
23
|
-
siteName: "Riebeckite Blog",
|
|
24
|
-
defaultImage: "/ogp.png",
|
|
25
|
-
feed: { rss: true, atom: true, json: true },
|
|
26
|
-
sitemap: true,
|
|
27
|
-
robots: true,
|
|
28
|
-
}),
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Options
|
|
34
|
-
|
|
35
|
-
| Option | Type | Description |
|
|
36
|
-
| ------ | ---- | ----------- |
|
|
37
|
-
| `siteName` | `string` | Site name used in page titles. Defaults to `site.title`. |
|
|
38
|
-
| `defaultImage` | `string` | Default OG image. Falls back to `site.defaultOgImage`. |
|
|
39
|
-
| `feed` | `{ rss?: boolean; atom?: boolean; json?: boolean }` | Feed output settings. |
|
|
40
|
-
| `sitemap` | `boolean` | Sitemap output settings. |
|
|
41
|
-
| `robots` | `boolean` | robots.txt output settings. |
|
|
42
|
-
|
|
43
|
-
## Generated metadata
|
|
44
|
-
|
|
45
|
-
### Articles (`buildArticleSeo`)
|
|
46
|
-
|
|
47
|
-
- `title`: `"{title} | {siteName}"`
|
|
48
|
-
- `description`: `frontmatter.description`, otherwise the first 160 characters
|
|
49
|
-
of the post text
|
|
50
|
-
- `canonicalUrl`: `frontmatter.canonical`, otherwise the entry's resolved canonical permalink
|
|
51
|
-
- `imageUrl`: `frontmatter.ogImage` / `frontmatter.image`, otherwise
|
|
52
|
-
`defaultImage` / `site.defaultOgImage`
|
|
53
|
-
- `noindex`: `frontmatter.noindex === true`
|
|
54
|
-
- `publishedTime`: `published` / `date` / `created`
|
|
55
|
-
- `modifiedTime`: `updated`, falling back to the publish time
|
|
56
|
-
- `tags`, `readingTimeMinutes`
|
|
57
|
-
- JSON-LD: `BlogPosting` and `BreadcrumbList`
|
|
58
|
-
|
|
59
|
-
### Websites (`buildWebsiteSeo`)
|
|
60
|
-
|
|
61
|
-
Title, description, canonical URL, default image, and JSON-LD `WebSite` +
|
|
62
|
-
`BreadcrumbList` for index, tag, and other non-article pages.
|
|
63
|
-
|
|
64
|
-
## Feeds, sitemap, and robots
|
|
65
|
-
|
|
66
|
-
| Function | Output |
|
|
67
|
-
| -------- | ------ |
|
|
68
|
-
| `renderSitemap` | `/sitemap.xml` — home page plus published, non-`noindex` entries |
|
|
69
|
-
| `renderRobots` | `/robots.txt` — allow all plus sitemap link |
|
|
70
|
-
| `renderRssFeed` | RSS 2.0 built from `config.site.feed` |
|
|
71
|
-
| `renderAtomFeed` | Atom feed |
|
|
72
|
-
| `renderJsonFeed` | JSON Feed 1.1 with `content_html` |
|
|
73
|
-
|
|
74
|
-
Feed and sitemap entries are filtered with `isPublished`, exclude
|
|
75
|
-
`noindex: true`, and are sorted by the most recent update first. Their URLs use
|
|
76
|
-
each entry's resolved canonical `permalink` (`ContentManifestEntry.permalink`);
|
|
77
|
-
they are never rebuilt from slugs.
|
|
78
|
-
|
|
79
|
-
## Reading time
|
|
80
|
-
|
|
81
|
-
`calculateReadingTime` counts CJK characters (500/min) and Latin words
|
|
82
|
-
(220/min), rounding up to at least 1 minute.
|
|
83
|
-
|
|
84
|
-
## Frontmatter fields
|
|
85
|
-
|
|
86
|
-
| Field | Use |
|
|
87
|
-
| ----- | --- |
|
|
88
|
-
| `title` | Article title (falls back to the last slug segment) |
|
|
89
|
-
| `description` | Meta description |
|
|
90
|
-
| `canonical` | Canonical URL |
|
|
91
|
-
| `image` / `ogImage` | OG image |
|
|
92
|
-
| `published` / `date` / `created` | Publish time |
|
|
93
|
-
| `updated` | Modified time |
|
|
94
|
-
| `tags` | Keywords / feed tags |
|
|
95
|
-
| `noindex` | `noindex` meta, feed and sitemap exclusion |
|
|
96
|
-
|
|
97
|
-
## Exports
|
|
98
|
-
|
|
99
|
-
- `seo(options?)` — plugin factory
|
|
100
|
-
- Types: `SeoPluginOptions`, `FeedOptions`, `SeoMetadata`, `WebsiteSeoInput`,
|
|
101
|
-
`RenderableFeedEntry`
|
|
102
|
-
- Helpers: `buildArticleSeo`, `buildWebsiteSeo`, `buildAbsoluteUrl`,
|
|
103
|
-
`buildPostUrl`, `getDescription`, `filterFeedEntries`,
|
|
104
|
-
`getEntryPublishedTime`, `getEntryUpdatedTime`, `getHtmlLanguage`,
|
|
105
|
-
`calculateReadingTime`, `renderSitemap`, `renderRobots`, `renderRssFeed`,
|
|
106
|
-
`renderAtomFeed`, `renderJsonFeed`
|
|
107
|
-
|
|
108
|
-
## See also
|
|
109
|
-
|
|
110
|
-
- [Plugin guide](../../../docs/en/plugin-
|
|
1
|
+
# @riebeckite/plugin-seo
|
|
2
|
+
|
|
3
|
+
SEO metadata, sitemap, robots.txt, and feed generation for Riebeckite.
|
|
4
|
+
|
|
5
|
+
[日本語](./README_ja.md)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
`seo()` provides a `PluginSeoExtension` consumed by the Riebeckite app. It
|
|
10
|
+
builds per-page SEO metadata and renders `/sitemap.xml`, `/robots.txt`, and
|
|
11
|
+
RSS / Atom / JSON feeds.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { defineConfig } from "@riebeckite/core";
|
|
17
|
+
import { seo } from "@riebeckite/plugin-seo";
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
// ...
|
|
21
|
+
plugins: [
|
|
22
|
+
seo({
|
|
23
|
+
siteName: "Riebeckite Blog",
|
|
24
|
+
defaultImage: "/ogp.png",
|
|
25
|
+
feed: { rss: true, atom: true, json: true },
|
|
26
|
+
sitemap: true,
|
|
27
|
+
robots: true,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
| Option | Type | Description |
|
|
36
|
+
| ------ | ---- | ----------- |
|
|
37
|
+
| `siteName` | `string` | Site name used in page titles. Defaults to `site.title`. |
|
|
38
|
+
| `defaultImage` | `string` | Default OG image. Falls back to `site.defaultOgImage`. |
|
|
39
|
+
| `feed` | `{ rss?: boolean; atom?: boolean; json?: boolean }` | Feed output settings. |
|
|
40
|
+
| `sitemap` | `boolean` | Sitemap output settings. |
|
|
41
|
+
| `robots` | `boolean` | robots.txt output settings. |
|
|
42
|
+
|
|
43
|
+
## Generated metadata
|
|
44
|
+
|
|
45
|
+
### Articles (`buildArticleSeo`)
|
|
46
|
+
|
|
47
|
+
- `title`: `"{title} | {siteName}"`
|
|
48
|
+
- `description`: `frontmatter.description`, otherwise the first 160 characters
|
|
49
|
+
of the post text
|
|
50
|
+
- `canonicalUrl`: `frontmatter.canonical`, otherwise the entry's resolved canonical permalink
|
|
51
|
+
- `imageUrl`: `frontmatter.ogImage` / `frontmatter.image`, otherwise
|
|
52
|
+
`defaultImage` / `site.defaultOgImage`
|
|
53
|
+
- `noindex`: `frontmatter.noindex === true`
|
|
54
|
+
- `publishedTime`: `published` / `date` / `created`
|
|
55
|
+
- `modifiedTime`: `updated`, falling back to the publish time
|
|
56
|
+
- `tags`, `readingTimeMinutes`
|
|
57
|
+
- JSON-LD: `BlogPosting` and `BreadcrumbList`
|
|
58
|
+
|
|
59
|
+
### Websites (`buildWebsiteSeo`)
|
|
60
|
+
|
|
61
|
+
Title, description, canonical URL, default image, and JSON-LD `WebSite` +
|
|
62
|
+
`BreadcrumbList` for index, tag, and other non-article pages.
|
|
63
|
+
|
|
64
|
+
## Feeds, sitemap, and robots
|
|
65
|
+
|
|
66
|
+
| Function | Output |
|
|
67
|
+
| -------- | ------ |
|
|
68
|
+
| `renderSitemap` | `/sitemap.xml` — home page plus published, non-`noindex` entries |
|
|
69
|
+
| `renderRobots` | `/robots.txt` — allow all plus sitemap link |
|
|
70
|
+
| `renderRssFeed` | RSS 2.0 built from `config.site.feed` |
|
|
71
|
+
| `renderAtomFeed` | Atom feed |
|
|
72
|
+
| `renderJsonFeed` | JSON Feed 1.1 with `content_html` |
|
|
73
|
+
|
|
74
|
+
Feed and sitemap entries are filtered with `isPublished`, exclude
|
|
75
|
+
`noindex: true`, and are sorted by the most recent update first. Their URLs use
|
|
76
|
+
each entry's resolved canonical `permalink` (`ContentManifestEntry.permalink`);
|
|
77
|
+
they are never rebuilt from slugs.
|
|
78
|
+
|
|
79
|
+
## Reading time
|
|
80
|
+
|
|
81
|
+
`calculateReadingTime` counts CJK characters (500/min) and Latin words
|
|
82
|
+
(220/min), rounding up to at least 1 minute.
|
|
83
|
+
|
|
84
|
+
## Frontmatter fields
|
|
85
|
+
|
|
86
|
+
| Field | Use |
|
|
87
|
+
| ----- | --- |
|
|
88
|
+
| `title` | Article title (falls back to the last slug segment) |
|
|
89
|
+
| `description` | Meta description |
|
|
90
|
+
| `canonical` | Canonical URL |
|
|
91
|
+
| `image` / `ogImage` | OG image |
|
|
92
|
+
| `published` / `date` / `created` | Publish time |
|
|
93
|
+
| `updated` | Modified time |
|
|
94
|
+
| `tags` | Keywords / feed tags |
|
|
95
|
+
| `noindex` | `noindex` meta, feed and sitemap exclusion |
|
|
96
|
+
|
|
97
|
+
## Exports
|
|
98
|
+
|
|
99
|
+
- `seo(options?)` — plugin factory
|
|
100
|
+
- Types: `SeoPluginOptions`, `FeedOptions`, `SeoMetadata`, `WebsiteSeoInput`,
|
|
101
|
+
`RenderableFeedEntry`
|
|
102
|
+
- Helpers: `buildArticleSeo`, `buildWebsiteSeo`, `buildAbsoluteUrl`,
|
|
103
|
+
`buildPostUrl`, `getDescription`, `filterFeedEntries`,
|
|
104
|
+
`getEntryPublishedTime`, `getEntryUpdatedTime`, `getHtmlLanguage`,
|
|
105
|
+
`calculateReadingTime`, `renderSitemap`, `renderRobots`, `renderRssFeed`,
|
|
106
|
+
`renderAtomFeed`, `renderJsonFeed`
|
|
107
|
+
|
|
108
|
+
## See also
|
|
109
|
+
|
|
110
|
+
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
package/README_ja.md
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
# @riebeckite/plugin-seo
|
|
2
|
-
|
|
3
|
-
記事のメタデータ、サイトマップ、robots.txt、RSS・Atom・JSON Feed をまとめて生成するプラグインです。アプリケーションはプラグインが提供する SEO 拡張を受け取り、各ページの出力に利用します。
|
|
4
|
-
|
|
5
|
-
[English](./README.md)
|
|
6
|
-
|
|
7
|
-
## 設定する
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import { defineConfig } from "@riebeckite/core";
|
|
11
|
-
import { seo } from "@riebeckite/plugin-seo";
|
|
12
|
-
|
|
13
|
-
export default defineConfig({
|
|
14
|
-
// ...
|
|
15
|
-
plugins: [
|
|
16
|
-
seo({
|
|
17
|
-
siteName: "Riebeckite Blog",
|
|
18
|
-
defaultImage: "/ogp.png",
|
|
19
|
-
feed: { rss: true, atom: true, json: true },
|
|
20
|
-
sitemap: true,
|
|
21
|
-
robots: true,
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
| 項目 | 説明 |
|
|
28
|
-
| --- | --- |
|
|
29
|
-
| `siteName` | ページタイトルに使うサイト名。省略時は `site.title` |
|
|
30
|
-
| `defaultImage` | 既定の OGP 画像。省略時は `site.defaultOgImage` |
|
|
31
|
-
| `feed` | RSS、Atom、JSON Feed の出力を個別に有効化する |
|
|
32
|
-
| `sitemap` | サイトマップを出力する |
|
|
33
|
-
| `robots` | robots.txt を出力する |
|
|
34
|
-
|
|
35
|
-
## 記事の frontmatter が出力を決める
|
|
36
|
-
|
|
37
|
-
`buildArticleSeo()` は記事タイトル、説明、canonical URL、OGP 画像、公開・更新日時、タグ、読了時間を組み立て、`BlogPosting` と `BreadcrumbList` の JSON-LD を作ります。値は次の順で補完されます。
|
|
38
|
-
|
|
39
|
-
| フィールド | 用途 |
|
|
40
|
-
| --- | --- |
|
|
41
|
-
| `title` | 記事タイトル。なければ slug の末尾 |
|
|
42
|
-
| `description` | meta description。なければ本文の先頭 160 文字 |
|
|
43
|
-
| `canonical` | 正規 URL。なければ解決済みの canonical permalink |
|
|
44
|
-
| `image` / `ogImage` | OGP 画像。なければ設定上の既定画像 |
|
|
45
|
-
| `published` / `date` / `created` | 公開日時 |
|
|
46
|
-
| `updated` | 更新日時。なければ公開日時 |
|
|
47
|
-
| `tags` | キーワードとフィードのタグ |
|
|
48
|
-
| `noindex` | 検索エンジン向けの noindex と、サイトマップ・フィードからの除外 |
|
|
49
|
-
|
|
50
|
-
記事以外には `buildWebsiteSeo()` を使えます。トップやタグ一覧向けに `WebSite` と `BreadcrumbList` の構造化データを作ります。
|
|
51
|
-
|
|
52
|
-
## 公開物に含まれる記事
|
|
53
|
-
|
|
54
|
-
サイトマップとフィードは、公開済みで `noindex: true` ではないエントリーだけを対象にし、更新日時の新しい順に並べます。URL には各エントリーの解決済み canonical `permalink`(`ContentManifestEntry.permalink`)を使い、slug から再構築しません。出力関数は `renderSitemap`、`renderRobots`、`renderRssFeed`、`renderAtomFeed`、`renderJsonFeed` です。
|
|
55
|
-
|
|
56
|
-
読了時間は CJK 文字を毎分 500 文字、ラテン文字の単語を毎分 220 語として数え、最低 1 分に切り上げます。
|
|
57
|
-
|
|
58
|
-
## 主なエクスポート
|
|
59
|
-
|
|
60
|
-
- `seo(options?)`: プラグインを作成する
|
|
61
|
-
- `buildArticleSeo`、`buildWebsiteSeo`: ページの SEO 情報を構築する
|
|
62
|
-
- `renderSitemap`、`renderRobots`、`renderRssFeed`、`renderAtomFeed`、`renderJsonFeed`: 公開用ファイルを描画する
|
|
63
|
-
- `calculateReadingTime`: 読了時間を計算する
|
|
64
|
-
- 型: `SeoPluginOptions`、`FeedOptions`、`SeoMetadata`、`WebsiteSeoInput`、`RenderableFeedEntry`
|
|
65
|
-
|
|
66
|
-
## 関連資料
|
|
67
|
-
|
|
68
|
-
- [プラグインシステム](../../../docs/ja/plugin-
|
|
1
|
+
# @riebeckite/plugin-seo
|
|
2
|
+
|
|
3
|
+
記事のメタデータ、サイトマップ、robots.txt、RSS・Atom・JSON Feed をまとめて生成するプラグインです。アプリケーションはプラグインが提供する SEO 拡張を受け取り、各ページの出力に利用します。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
## 設定する
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { defineConfig } from "@riebeckite/core";
|
|
11
|
+
import { seo } from "@riebeckite/plugin-seo";
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
// ...
|
|
15
|
+
plugins: [
|
|
16
|
+
seo({
|
|
17
|
+
siteName: "Riebeckite Blog",
|
|
18
|
+
defaultImage: "/ogp.png",
|
|
19
|
+
feed: { rss: true, atom: true, json: true },
|
|
20
|
+
sitemap: true,
|
|
21
|
+
robots: true,
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| 項目 | 説明 |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `siteName` | ページタイトルに使うサイト名。省略時は `site.title` |
|
|
30
|
+
| `defaultImage` | 既定の OGP 画像。省略時は `site.defaultOgImage` |
|
|
31
|
+
| `feed` | RSS、Atom、JSON Feed の出力を個別に有効化する |
|
|
32
|
+
| `sitemap` | サイトマップを出力する |
|
|
33
|
+
| `robots` | robots.txt を出力する |
|
|
34
|
+
|
|
35
|
+
## 記事の frontmatter が出力を決める
|
|
36
|
+
|
|
37
|
+
`buildArticleSeo()` は記事タイトル、説明、canonical URL、OGP 画像、公開・更新日時、タグ、読了時間を組み立て、`BlogPosting` と `BreadcrumbList` の JSON-LD を作ります。値は次の順で補完されます。
|
|
38
|
+
|
|
39
|
+
| フィールド | 用途 |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `title` | 記事タイトル。なければ slug の末尾 |
|
|
42
|
+
| `description` | meta description。なければ本文の先頭 160 文字 |
|
|
43
|
+
| `canonical` | 正規 URL。なければ解決済みの canonical permalink |
|
|
44
|
+
| `image` / `ogImage` | OGP 画像。なければ設定上の既定画像 |
|
|
45
|
+
| `published` / `date` / `created` | 公開日時 |
|
|
46
|
+
| `updated` | 更新日時。なければ公開日時 |
|
|
47
|
+
| `tags` | キーワードとフィードのタグ |
|
|
48
|
+
| `noindex` | 検索エンジン向けの noindex と、サイトマップ・フィードからの除外 |
|
|
49
|
+
|
|
50
|
+
記事以外には `buildWebsiteSeo()` を使えます。トップやタグ一覧向けに `WebSite` と `BreadcrumbList` の構造化データを作ります。
|
|
51
|
+
|
|
52
|
+
## 公開物に含まれる記事
|
|
53
|
+
|
|
54
|
+
サイトマップとフィードは、公開済みで `noindex: true` ではないエントリーだけを対象にし、更新日時の新しい順に並べます。URL には各エントリーの解決済み canonical `permalink`(`ContentManifestEntry.permalink`)を使い、slug から再構築しません。出力関数は `renderSitemap`、`renderRobots`、`renderRssFeed`、`renderAtomFeed`、`renderJsonFeed` です。
|
|
55
|
+
|
|
56
|
+
読了時間は CJK 文字を毎分 500 文字、ラテン文字の単語を毎分 220 語として数え、最低 1 分に切り上げます。
|
|
57
|
+
|
|
58
|
+
## 主なエクスポート
|
|
59
|
+
|
|
60
|
+
- `seo(options?)`: プラグインを作成する
|
|
61
|
+
- `buildArticleSeo`、`buildWebsiteSeo`: ページの SEO 情報を構築する
|
|
62
|
+
- `renderSitemap`、`renderRobots`、`renderRssFeed`、`renderAtomFeed`、`renderJsonFeed`: 公開用ファイルを描画する
|
|
63
|
+
- `calculateReadingTime`: 読了時間を計算する
|
|
64
|
+
- 型: `SeoPluginOptions`、`FeedOptions`、`SeoMetadata`、`WebsiteSeoInput`、`RenderableFeedEntry`
|
|
65
|
+
|
|
66
|
+
## 関連資料
|
|
67
|
+
|
|
68
|
+
- [プラグインシステム](../../../docs/ja/reference/plugin-api.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-seo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@riebeckite/core": "0.0.
|
|
17
|
+
"@riebeckite/core": "0.0.13"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsx": "^4.22.4",
|
|
21
|
-
"@riebeckite/test": "0.0.
|
|
21
|
+
"@riebeckite/test": "0.0.13"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|