@easy-cms/plugin-seo 0.46.0 → 0.47.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 { RequestContext, EasyCMS, AuthUser, Field, Label as Label$1, TypedPlugin } from '@easy-cms/core';
1
+ import { RequestContext, EasyCMS, AuthUser, Label as Label$1, Field, TypedPlugin } from '@easy-cms/core';
2
2
 
3
3
  interface IndexNowOptions {
4
4
  /**
@@ -378,6 +378,12 @@ interface SeoPluginOptions {
378
378
  readonly globals?: readonly string[];
379
379
  /** `main`: below the other fields (room for the search preview). `sidebar`: the side column. Default `main`. */
380
380
  readonly position?: 'main' | 'sidebar';
381
+ /**
382
+ * With `position: 'main'`: the SEO fields in a tab of their own on the edit page, after the
383
+ * others (`admin.layout`); its label, or `false` to leave them below the other fields. Default
384
+ * `true` (labelled like the group).
385
+ */
386
+ readonly tab?: boolean | Label$1;
381
387
  /** Suggests a meta title, e.g. `({ doc }) => \`${doc.title} | My Blog\``. Adds a Generate button. */
382
388
  readonly generateTitle?: Generate<string>;
383
389
  /** Suggests a meta description, e.g. from an excerpt. Adds a Generate button. */
package/dist/index.js CHANGED
@@ -522,7 +522,7 @@ function jsonLdScript(value) {
522
522
  // src/info.ts
523
523
  var INFO = {
524
524
  name: "@easy-cms/plugin-seo",
525
- ...true ? { version: "0.46.0" } : {}
525
+ ...true ? { version: "0.47.0" } : {}
526
526
  };
527
527
 
528
528
  // src/robots.ts
@@ -813,6 +813,13 @@ function seoPlugin(options = {}) {
813
813
  if (indexNow && live(doc))
814
814
  indexNow.submit(await urlsOf(doc, { collection: slug }, cms), cms.logger);
815
815
  };
816
+ const tabLabel = typeof options.tab === "string" || typeof options.tab === "object" && options.tab !== null ? options.tab : options.label ?? "SEO";
817
+ const withSeoTab = (layout) => {
818
+ const seo = { tab: tabLabel, fields: [META_FIELD] };
819
+ const tabbed = (layout ?? []).length > 0 && (layout ?? []).every((n) => typeof n === "object" && "tab" in n);
820
+ if (tabbed) return [...layout, seo];
821
+ return [{ tab: { en: "Content", th: "\u0E40\u0E19\u0E37\u0E49\u0E2D\u0E2B\u0E32" }, fields: [...layout ?? []] }, seo];
822
+ };
816
823
  const withSeo = (container, titleField) => {
817
824
  if (container.fields.some((f) => f.name === META_FIELD))
818
825
  throw new Error(`seoPlugin: "${container.slug}" already has a field named "${META_FIELD}"`);
@@ -827,7 +834,8 @@ function seoPlugin(options = {}) {
827
834
  return {
828
835
  ...container,
829
836
  fields: [...container.fields, group(titleField)],
830
- ...hook || indexNow ? { hooks } : {}
837
+ ...hook || indexNow ? { hooks } : {},
838
+ ...options.position !== "sidebar" && options.tab !== false ? { admin: { ...container.admin, layout: withSeoTab(container.admin?.layout) } } : {}
831
839
  };
832
840
  };
833
841
  const endpoint = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/plugin-seo",
3
- "version": "0.46.0",
3
+ "version": "0.47.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.46.0"
20
+ "@easy-cms/richtext": "^0.47.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@easy-cms/core": "^0.46.0"
23
+ "@easy-cms/core": "^0.47.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "happy-dom": "^20.14.5",
27
- "@easy-cms/core": "^0.46.0",
28
- "@easy-cms/db-sqlite": "^0.46.0"
27
+ "@easy-cms/core": "^0.47.0",
28
+ "@easy-cms/db-sqlite": "^0.47.0"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.12"