@easy-cms/plugin-seo 0.24.0 → 0.25.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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EasyCMS, AuthUser, Field, Label as Label$1, Plugin } from '@easy-cms/core';
1
+ import { EasyCMS, AuthUser, Field, Label as Label$1, TypedPlugin } from '@easy-cms/core';
2
2
 
3
3
  interface IndexNowOptions {
4
4
  /**
@@ -419,7 +419,42 @@ interface SeoPluginOptions {
419
419
  * Adds a `meta` group (title, description, image) to the chosen collections and globals,
420
420
  * with length meters, a search result preview and Generate buttons in the admin.
421
421
  */
422
- declare function seoPlugin(options?: SeoPluginOptions): Plugin;
422
+ /** The `meta` group the plugin adds, as the inferred document types see it. */
423
+ type SeoMetaField = {
424
+ readonly name: 'meta';
425
+ readonly type: 'group';
426
+ readonly fields: readonly [
427
+ {
428
+ readonly name: 'title';
429
+ readonly type: 'text';
430
+ },
431
+ {
432
+ readonly name: 'description';
433
+ readonly type: 'textarea';
434
+ },
435
+ {
436
+ readonly name: 'image';
437
+ readonly type: 'upload';
438
+ },
439
+ {
440
+ readonly name: 'noindex';
441
+ readonly type: 'boolean';
442
+ }
443
+ ];
444
+ };
445
+ /** What `seoPlugin(options)` adds: `meta` on the collections and globals it was given. */
446
+ type SeoPluginTypes<C extends string, G extends string> = {
447
+ readonly fields: {
448
+ readonly [S in C]: readonly [SeoMetaField];
449
+ };
450
+ readonly globalFields: {
451
+ readonly [S in G]: readonly [SeoMetaField];
452
+ };
453
+ };
454
+ declare function seoPlugin<const C extends string = never, const G extends string = never>(options?: SeoPluginOptions & {
455
+ readonly collections?: readonly C[];
456
+ readonly globals?: readonly G[];
457
+ }): TypedPlugin<SeoPluginTypes<C, G>>;
423
458
 
424
459
  /** Shared by the server plugin and the admin module (which must not import anything else). */
425
460
  /** Length ranges search engines show in full, from Payload's SEO plugin and Google's guidance. */
@@ -469,4 +504,4 @@ declare function sitemap(cms: SeoCMS, options?: SitemapOptions): Promise<Sitemap
469
504
  */
470
505
  declare function sitemapXml(cms: SeoCMS, options?: SitemapXmlOptions): Promise<string>;
471
506
 
472
- export { AI_CRAWLERS, DEFAULT_DESCRIPTION_LENGTH, DEFAULT_TITLE_LENGTH, type DocMarkdownOptions, type Generate, type GenerateArgs, type IndexNowOptions, type JsonLd, type LlmsFullTxtOptions, type LlmsOptions, type LlmsTxtOptions, type NextSeoMetadata, type NuxtSeoHead, type NuxtSeoMeta, type RobotsRule, type RobotsTxtOptions, SITEMAP_LIMIT, type SeoBreadcrumb, type SeoImage, type SeoMeta, type SeoMetaOptions, type SeoPluginOptions, type SiteJsonLdOptions, type SitemapEntry, type SitemapOptions, type SitemapXmlOptions, docMarkdown, indexNowKeyFile, jsonLdScript, llmsFullTxt, llmsTxt, robotsTxt, seoMeta, seoPlugin, siteJsonLd, sitemap, sitemapXml };
507
+ export { AI_CRAWLERS, DEFAULT_DESCRIPTION_LENGTH, DEFAULT_TITLE_LENGTH, type DocMarkdownOptions, type Generate, type GenerateArgs, type IndexNowOptions, type JsonLd, type LlmsFullTxtOptions, type LlmsOptions, type LlmsTxtOptions, type NextSeoMetadata, type NuxtSeoHead, type NuxtSeoMeta, type RobotsRule, type RobotsTxtOptions, SITEMAP_LIMIT, type SeoBreadcrumb, type SeoImage, type SeoMeta, type SeoMetaField, type SeoMetaOptions, type SeoPluginOptions, type SeoPluginTypes, type SiteJsonLdOptions, type SitemapEntry, type SitemapOptions, type SitemapXmlOptions, docMarkdown, indexNowKeyFile, jsonLdScript, llmsFullTxt, llmsTxt, robotsTxt, seoMeta, seoPlugin, siteJsonLd, sitemap, sitemapXml };
package/dist/index.js CHANGED
@@ -648,7 +648,7 @@ var xml = (value) => value.replace(
648
648
  var ADMIN_MODULE = "@easy-cms/plugin-seo/admin";
649
649
  var TEXT_KINDS = ["title", "description"];
650
650
  function seoPlugin(options = {}) {
651
- return (config) => {
651
+ const plugin = (config) => {
652
652
  const collections = options.collections ?? [];
653
653
  const globals = options.globals ?? [];
654
654
  const known = (list, slugs, kind) => {
@@ -947,6 +947,7 @@ function seoPlugin(options = {}) {
947
947
  endpoints: [...config.endpoints ?? [], endpoint, ...siteEndpoints]
948
948
  };
949
949
  };
950
+ return plugin;
950
951
  }
951
952
  var isEmpty = (value) => value === null || value === void 0 || value === "";
952
953
  function error(status, message) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/plugin-seo",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "SEO for Easy CMS: meta fields, length meters, a search result preview, generators and page metadata",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,15 +17,15 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@easy-cms/richtext": "^0.24.0"
20
+ "@easy-cms/richtext": "^0.25.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@easy-cms/core": "^0.24.0"
23
+ "@easy-cms/core": "^0.25.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "happy-dom": "^20.14.5",
27
- "@easy-cms/core": "^0.24.0",
28
- "@easy-cms/db-sqlite": "^0.24.0"
27
+ "@easy-cms/core": "^0.25.0",
28
+ "@easy-cms/db-sqlite": "^0.25.0"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.12"