@payloadcms/plugin-seo 1.0.7 → 1.0.8
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 +19 -12
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
A plugin for [Payload CMS](https://github.com/payloadcms/payload) to auto-generate SEO meta data based on the content of your documents.
|
|
6
6
|
|
|
7
7
|
Core features:
|
|
8
|
-
- Adds a `meta` field to every SEO-enabled collection
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
8
|
+
- Adds a `meta` field to every SEO-enabled collection or global. It:
|
|
9
|
+
- includes title, description, and image subfields
|
|
10
|
+
- auto-generates meta data from your document's content
|
|
11
|
+
- displays hints and indicators to help content editors
|
|
12
|
+
- renders a snippet of what a search engine might display
|
|
13
|
+
- soon will support variable injection
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -59,16 +59,23 @@ export default config;
|
|
|
59
59
|
|
|
60
60
|
### Options
|
|
61
61
|
|
|
62
|
-
- `collections`
|
|
62
|
+
- `collections` : string[] | optional
|
|
63
63
|
|
|
64
64
|
An array of collections slugs to enable SEO. Enabled collections receive a `meta` field which is an object of title, description, and image subfields.
|
|
65
65
|
|
|
66
|
+
- `globals` : string[] | optional
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
An array of global slugs to enable SEO. Enabled globals receive a `meta` field which is an object of title, description, and image subfields.
|
|
69
|
+
|
|
70
|
+
- `uploadsCollection` : string | optional
|
|
68
71
|
|
|
69
72
|
An upload-enabled collection slug, for the meta image to access.
|
|
70
73
|
|
|
71
|
-
- `
|
|
74
|
+
- `tabbedUI` : boolean | optional
|
|
75
|
+
|
|
76
|
+
Displays meta fields as tabs using Payload's [Tabs Field](https://payloadcms.com/docs/fields/tabs). Defaults to `false`.
|
|
77
|
+
|
|
78
|
+
- `generateTitle` : method | optional
|
|
72
79
|
|
|
73
80
|
A function that allows you to return any meta title, including from document's content.
|
|
74
81
|
|
|
@@ -79,7 +86,7 @@ export default config;
|
|
|
79
86
|
})
|
|
80
87
|
```
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
- `generateDescription` : method | optional
|
|
83
90
|
|
|
84
91
|
A function that allows you to return any meta description, including from document's content.
|
|
85
92
|
|
|
@@ -90,7 +97,7 @@ export default config;
|
|
|
90
97
|
})
|
|
91
98
|
```
|
|
92
99
|
|
|
93
|
-
|
|
100
|
+
- `generateImage` : method | optional
|
|
94
101
|
|
|
95
102
|
A function that allows you to return any meta image, including from document's content.
|
|
96
103
|
|
|
@@ -101,7 +108,7 @@ export default config;
|
|
|
101
108
|
})
|
|
102
109
|
```
|
|
103
110
|
|
|
104
|
-
|
|
111
|
+
- `generateURL` : method | optional
|
|
105
112
|
|
|
106
113
|
A function called by the search preview component to display the actual URL of your page.
|
|
107
114
|
|
package/dist/index.js
CHANGED
|
@@ -90,11 +90,18 @@ var seo = function (seoConfig) { return function (config) {
|
|
|
90
90
|
}
|
|
91
91
|
];
|
|
92
92
|
return (__assign(__assign({}, config), { collections: ((_a = config.collections) === null || _a === void 0 ? void 0 : _a.map(function (collection) {
|
|
93
|
-
var _a;
|
|
93
|
+
var _a, _b;
|
|
94
94
|
var slug = collection.slug;
|
|
95
95
|
var isEnabled = (_a = seoConfig === null || seoConfig === void 0 ? void 0 : seoConfig.collections) === null || _a === void 0 ? void 0 : _a.includes(slug);
|
|
96
96
|
if (isEnabled) {
|
|
97
|
-
return (__assign(__assign({}, collection), { fields:
|
|
97
|
+
return (__assign(__assign({}, collection), { fields: ((seoConfig === null || seoConfig === void 0 ? void 0 : seoConfig.tabbedUI) ? [
|
|
98
|
+
{
|
|
99
|
+
type: 'tabs', tabs: [
|
|
100
|
+
{ label: ((_b = collection === null || collection === void 0 ? void 0 : collection.labels) === null || _b === void 0 ? void 0 : _b.singular) || 'Content', fields: __spreadArray([], ((collection === null || collection === void 0 ? void 0 : collection.fields) || []), true) },
|
|
101
|
+
{ label: 'SEO', fields: __spreadArray([], seoFields, true) },
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
] : __spreadArray(__spreadArray([], (collection === null || collection === void 0 ? void 0 : collection.fields) || [], true), seoFields, true)) }));
|
|
98
105
|
}
|
|
99
106
|
return collection;
|
|
100
107
|
})) || [], globals: ((_b = config.globals) === null || _b === void 0 ? void 0 : _b.map(function (global) {
|
|
@@ -102,7 +109,14 @@ var seo = function (seoConfig) { return function (config) {
|
|
|
102
109
|
var slug = global.slug;
|
|
103
110
|
var isEnabled = (_a = seoConfig === null || seoConfig === void 0 ? void 0 : seoConfig.globals) === null || _a === void 0 ? void 0 : _a.includes(slug);
|
|
104
111
|
if (isEnabled) {
|
|
105
|
-
return (__assign(__assign({}, global), { fields:
|
|
112
|
+
return (__assign(__assign({}, global), { fields: ((seoConfig === null || seoConfig === void 0 ? void 0 : seoConfig.tabbedUI) ? [
|
|
113
|
+
{
|
|
114
|
+
type: 'tabs', tabs: [
|
|
115
|
+
{ label: (global === null || global === void 0 ? void 0 : global.label) || 'Content', fields: __spreadArray([], ((global === null || global === void 0 ? void 0 : global.fields) || []), true) },
|
|
116
|
+
{ label: 'SEO', fields: __spreadArray([], seoFields, true) },
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
] : __spreadArray(__spreadArray([], (global === null || global === void 0 ? void 0 : global.fields) || [], true), seoFields, true)) }));
|
|
106
120
|
}
|
|
107
121
|
return global;
|
|
108
122
|
})) || [] }));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,4DAAmE;AACnE,0CAAyC;AACzC,gDAAuD;AACvD,wCAA+C;AAC/C,gDAAuD;A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