@easy-cms/plugin-seo 0.62.0 → 0.64.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.
Files changed (2) hide show
  1. package/dist/index.js +9 -5
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -524,7 +524,7 @@ var INFO = {
524
524
  name: "@easy-cms/plugin-seo",
525
525
  // The plugin API it is written for (`PLUGIN_API_VERSION` of @easy-cms/core).
526
526
  apiVersion: 1,
527
- ...true ? { version: "0.62.0" } : {}
527
+ ...true ? { version: "0.64.0" } : {}
528
528
  };
529
529
 
530
530
  // src/robots.ts
@@ -883,6 +883,7 @@ function seoPlugin(options = {}) {
883
883
  }
884
884
  });
885
885
  const api = config.routes?.api ?? "/api/cms";
886
+ const serverOrigin = (url) => config.serverURL?.replace(/\/+$/, "") || url.origin;
886
887
  const sitemapHandler = (base) => Object.assign(
887
888
  async ({ url, cms, context }) => {
888
889
  const site = config.admin?.siteURL || config.serverURL || url.origin;
@@ -891,7 +892,7 @@ function seoPlugin(options = {}) {
891
892
  siteURL: site,
892
893
  context,
893
894
  page: url.searchParams.get("page"),
894
- base: base(url.origin)
895
+ base: base(serverOrigin(url))
895
896
  })
896
897
  );
897
898
  },
@@ -917,9 +918,12 @@ function seoPlugin(options = {}) {
917
918
  path: "/robots.txt",
918
919
  method: "get",
919
920
  root: true,
920
- handler: ({ url }) => new Response(robotsTxt({ sitemap: `${url.origin}/sitemap.xml`, ...robots, config }), {
921
- headers: { "content-type": "text/plain; charset=utf-8" }
922
- })
921
+ handler: ({ url }) => new Response(
922
+ robotsTxt({ sitemap: `${serverOrigin(url)}/sitemap.xml`, ...robots, config }),
923
+ {
924
+ headers: { "content-type": "text/plain; charset=utf-8" }
925
+ }
926
+ )
923
927
  });
924
928
  }
925
929
  const textResponse = (body, type = "text/plain") => new Response(body, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/plugin-seo",
3
- "version": "0.62.0",
3
+ "version": "0.64.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.62.0"
20
+ "@easy-cms/richtext": "^0.64.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@easy-cms/core": "^0.62.0"
23
+ "@easy-cms/core": "^0.64.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "happy-dom": "^20.14.5",
27
- "@easy-cms/db-sqlite": "^0.62.0",
28
- "@easy-cms/core": "^0.62.0"
27
+ "@easy-cms/core": "^0.64.0",
28
+ "@easy-cms/db-sqlite": "^0.64.0"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.12"