@webbycrown/strapi-advanced-sitemap 1.0.3 → 1.0.5

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 CHANGED
@@ -9,6 +9,14 @@ SEO-ready XML sitemaps for Strapi CMS. Create manual URL sets or sitemap indexes
9
9
  📦 **NPM Package**: [@webbycrown/strapi-advanced-sitemap](https://www.npmjs.com/package/@webbycrown/strapi-advanced-sitemap)
10
10
  💻 **Repository**: [GitHub – webbycrown/strapi-advanced-sitemap](https://github.com/webbycrown/strapi-advanced-sitemap)
11
11
 
12
+ ## 🎥 Overview & Usage Demo
13
+
14
+ A short introduction and quick overview of **Strapi Advanced Sitemap**, showcasing how to build manual or dynamic XML sitemaps, publish sitemap indexes, and control access per role inside the Strapi admin panel.
15
+
16
+ [![Watch the demo](https://raw.githubusercontent.com/webbycrown/strapi-advanced-sitemap/main/assets/strapi-advanced-sitemap-play.png)](https://www.youtube.com/watch?v=4HBuf8fhNCQ)
17
+
18
+ ▶️ **[Watch Full Video on YouTube](https://www.youtube.com/watch?v=4HBuf8fhNCQ)**
19
+
12
20
  ---
13
21
 
14
22
  ## ✨ Features
@@ -157,38 +165,62 @@ Example pattern:
157
165
 
158
166
  ---
159
167
 
160
- ## 📝 License
168
+ ## 📦 Publishing Notes
161
169
 
162
- MIT see [LICENSE](LICENSE) for details.
170
+ When submitting to the Strapi Marketplace include:
171
+ - Summary: “Configure manual and dynamic XML sitemaps from the Strapi admin.”
172
+ - Feature bullets (manual vs index, collection patterns, permissions)
173
+ - Screenshots of the Settings UI
174
+ - Compatibility (Strapi version, Node version)
175
+ - Link to this README for docs
163
176
 
164
177
  ---
165
178
 
166
- ## 🆘 Support
179
+ ## 📣 Changelog
180
+
181
+
182
+ ### v1.0.5
183
+ - 📝 Updated README to include Youtube Image
184
+
185
+ ### v1.0.4
186
+
187
+ - 📝 Updated README to include Demo Video section
188
+ - ⚡ Improved documentation clarity for plugin setup and usage
189
+
190
+ ### v1.0.3
167
191
 
168
- - **Documentation**: [GitHub Wiki](https://github.com/webbycrown/strapi-advanced-sitemap/wiki)
169
- - **Issues**: [GitHub Issues](https://github.com/webbycrown/strapi-advanced-sitemap/issues)
170
- - **Discussions**: [GitHub Discussions](https://github.com/webbycrown/strapi-advanced-sitemap/discussions)
171
- - **Email**: info@webbycrown.com
192
+ - 🐛 Fixed bugs.
193
+ - 🛠️ Resolved minor issues affecting
172
194
 
173
- ## 🙏 Acknowledgments
195
+ ### v1.0.2
174
196
 
175
- - Built for the amazing [Strapi](https://strapi.io/) community
176
- - Inspired by modern form design principles
177
- - Thanks to all contributors and users
197
+ - 📝 README documentation updates
178
198
 
179
- ## 📊 Changelog
199
+ ### v1.0.1
200
+
201
+ - 📝 README documentation updates
202
+ - ✨ Improved helper text and UI hints in admin settings
180
203
 
181
204
  ### v1.0.0
182
- - ✨ Initial release of **Strapi Advanced Sitemap**
205
+
206
+ - ✨ Initial release of Strapi Advanced Sitemap
183
207
  - 🧭 Manual sitemap builder supporting URL sets and sitemap indexes
184
208
  - ⚙️ Dynamic collection sitemaps powered by pattern tokens
185
209
  - 🔐 Role-based access control for each sitemap endpoint
186
210
  - 🌍 Configurable frontend base URL with live preview inside the admin panel
187
211
  - 📦 Easy integration and management from Strapi settings
188
- - 🚀 Published to NPM: [@webbycrown/strapi-advanced-sitemap](https://www.npmjs.com/package/@webbycrown/strapi-advanced-sitemap)
212
+ - 🚀 Published to NPM: @webbycrown/strapi-advanced-sitemap
213
+
214
+ ---
215
+
216
+ ## 📝 License
217
+
218
+ MIT – see [LICENSE](LICENSE) for details.
189
219
 
190
220
  ---
191
221
 
192
222
  <div align="center">
193
- <strong>Made with ❤️ by <a href="https://webbycrown.com">WebbyCrown</a></strong>
223
+ <strong>Crafted with ❤️ by <a href="https://webbycrown.com">WebbyCrown</a></strong>
194
224
  </div>
225
+
226
+
@@ -8,7 +8,7 @@ import ReactDOM, { unstable_batchedUpdates as unstable_batchedUpdates$1 } from "
8
8
  import { useIntl, FormattedMessage } from "react-intl";
9
9
  import "@strapi/icons/symbols";
10
10
  import { styled, createGlobalStyle } from "styled-components";
11
- import { P as PLUGIN_ID } from "./index-lDBXYK9v.mjs";
11
+ import { P as PLUGIN_ID } from "./index-Dl67SY4J.mjs";
12
12
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
13
13
  function getDefaultExportFromCjs(x2) {
14
14
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -9984,7 +9984,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
9984
9984
  var ys = arrObjKeys(obj, inspect2);
9985
9985
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
9986
9986
  var protoTag = obj instanceof Object ? "" : "null prototype";
9987
- var stringTag2 = !isPlainObject2 && toStringTag$1 && Object(obj) === obj && toStringTag$1 in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
9987
+ var stringTag2 = !isPlainObject2 && toStringTag$1 && Object(obj) === obj && toStringTag$1 in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
9988
9988
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
9989
9989
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
9990
9990
  if (ys.length === 0) {
@@ -10009,25 +10009,25 @@ function canTrustToString(obj) {
10009
10009
  return !toStringTag$1 || !(typeof obj === "object" && (toStringTag$1 in obj || typeof obj[toStringTag$1] !== "undefined"));
10010
10010
  }
10011
10011
  function isArray$4(obj) {
10012
- return toStr(obj) === "[object Array]" && canTrustToString(obj);
10012
+ return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
10013
10013
  }
10014
10014
  function isDate$2(obj) {
10015
- return toStr(obj) === "[object Date]" && canTrustToString(obj);
10015
+ return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
10016
10016
  }
10017
10017
  function isRegExp$2(obj) {
10018
- return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
10018
+ return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
10019
10019
  }
10020
10020
  function isError(obj) {
10021
- return toStr(obj) === "[object Error]" && canTrustToString(obj);
10021
+ return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
10022
10022
  }
10023
10023
  function isString$1(obj) {
10024
- return toStr(obj) === "[object String]" && canTrustToString(obj);
10024
+ return toStr$1(obj) === "[object String]" && canTrustToString(obj);
10025
10025
  }
10026
10026
  function isNumber$1(obj) {
10027
- return toStr(obj) === "[object Number]" && canTrustToString(obj);
10027
+ return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
10028
10028
  }
10029
10029
  function isBoolean$1(obj) {
10030
- return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
10030
+ return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
10031
10031
  }
10032
10032
  function isSymbol(obj) {
10033
10033
  if (hasShammedSymbols) {
@@ -10063,7 +10063,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
10063
10063
  function has$5(obj, key) {
10064
10064
  return hasOwn$1.call(obj, key);
10065
10065
  }
10066
- function toStr(obj) {
10066
+ function toStr$1(obj) {
10067
10067
  return objectToString.call(obj);
10068
10068
  }
10069
10069
  function nameOf(f2) {
@@ -10372,7 +10372,7 @@ var syntax = SyntaxError;
10372
10372
  var uri = URIError;
10373
10373
  var abs$1 = Math.abs;
10374
10374
  var floor$1 = Math.floor;
10375
- var max$1 = Math.max;
10375
+ var max$2 = Math.max;
10376
10376
  var min$1 = Math.min;
10377
10377
  var pow$1 = Math.pow;
10378
10378
  var round$1 = Math.round;
@@ -10501,99 +10501,78 @@ function requireObject_getPrototypeOf() {
10501
10501
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
10502
10502
  return Object_getPrototypeOf;
10503
10503
  }
10504
- var implementation;
10505
- var hasRequiredImplementation;
10506
- function requireImplementation() {
10507
- if (hasRequiredImplementation) return implementation;
10508
- hasRequiredImplementation = 1;
10509
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
10510
- var toStr2 = Object.prototype.toString;
10511
- var max2 = Math.max;
10512
- var funcType = "[object Function]";
10513
- var concatty = function concatty2(a2, b2) {
10514
- var arr = [];
10515
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
10516
- arr[i2] = a2[i2];
10517
- }
10518
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
10519
- arr[j2 + a2.length] = b2[j2];
10520
- }
10521
- return arr;
10522
- };
10523
- var slicy = function slicy2(arrLike, offset) {
10524
- var arr = [];
10525
- for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
10526
- arr[j2] = arrLike[i2];
10504
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
10505
+ var toStr = Object.prototype.toString;
10506
+ var max$1 = Math.max;
10507
+ var funcType = "[object Function]";
10508
+ var concatty = function concatty2(a2, b2) {
10509
+ var arr = [];
10510
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
10511
+ arr[i2] = a2[i2];
10512
+ }
10513
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
10514
+ arr[j2 + a2.length] = b2[j2];
10515
+ }
10516
+ return arr;
10517
+ };
10518
+ var slicy = function slicy2(arrLike, offset) {
10519
+ var arr = [];
10520
+ for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
10521
+ arr[j2] = arrLike[i2];
10522
+ }
10523
+ return arr;
10524
+ };
10525
+ var joiny = function(arr, joiner) {
10526
+ var str = "";
10527
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
10528
+ str += arr[i2];
10529
+ if (i2 + 1 < arr.length) {
10530
+ str += joiner;
10527
10531
  }
10528
- return arr;
10529
- };
10530
- var joiny = function(arr, joiner) {
10531
- var str = "";
10532
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
10533
- str += arr[i2];
10534
- if (i2 + 1 < arr.length) {
10535
- str += joiner;
10532
+ }
10533
+ return str;
10534
+ };
10535
+ var implementation$1 = function bind(that) {
10536
+ var target = this;
10537
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
10538
+ throw new TypeError(ERROR_MESSAGE + target);
10539
+ }
10540
+ var args = slicy(arguments, 1);
10541
+ var bound;
10542
+ var binder = function() {
10543
+ if (this instanceof bound) {
10544
+ var result = target.apply(
10545
+ this,
10546
+ concatty(args, arguments)
10547
+ );
10548
+ if (Object(result) === result) {
10549
+ return result;
10536
10550
  }
10551
+ return this;
10537
10552
  }
10538
- return str;
10553
+ return target.apply(
10554
+ that,
10555
+ concatty(args, arguments)
10556
+ );
10539
10557
  };
10540
- implementation = function bind2(that) {
10541
- var target = this;
10542
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
10543
- throw new TypeError(ERROR_MESSAGE + target);
10544
- }
10545
- var args = slicy(arguments, 1);
10546
- var bound;
10547
- var binder = function() {
10548
- if (this instanceof bound) {
10549
- var result = target.apply(
10550
- this,
10551
- concatty(args, arguments)
10552
- );
10553
- if (Object(result) === result) {
10554
- return result;
10555
- }
10556
- return this;
10557
- }
10558
- return target.apply(
10559
- that,
10560
- concatty(args, arguments)
10561
- );
10558
+ var boundLength = max$1(0, target.length - args.length);
10559
+ var boundArgs = [];
10560
+ for (var i2 = 0; i2 < boundLength; i2++) {
10561
+ boundArgs[i2] = "$" + i2;
10562
+ }
10563
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
10564
+ if (target.prototype) {
10565
+ var Empty = function Empty2() {
10562
10566
  };
10563
- var boundLength = max2(0, target.length - args.length);
10564
- var boundArgs = [];
10565
- for (var i2 = 0; i2 < boundLength; i2++) {
10566
- boundArgs[i2] = "$" + i2;
10567
- }
10568
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
10569
- if (target.prototype) {
10570
- var Empty = function Empty2() {
10571
- };
10572
- Empty.prototype = target.prototype;
10573
- bound.prototype = new Empty();
10574
- Empty.prototype = null;
10575
- }
10576
- return bound;
10577
- };
10578
- return implementation;
10579
- }
10580
- var functionBind;
10581
- var hasRequiredFunctionBind;
10582
- function requireFunctionBind() {
10583
- if (hasRequiredFunctionBind) return functionBind;
10584
- hasRequiredFunctionBind = 1;
10585
- var implementation2 = requireImplementation();
10586
- functionBind = Function.prototype.bind || implementation2;
10587
- return functionBind;
10588
- }
10589
- var functionCall;
10590
- var hasRequiredFunctionCall;
10591
- function requireFunctionCall() {
10592
- if (hasRequiredFunctionCall) return functionCall;
10593
- hasRequiredFunctionCall = 1;
10594
- functionCall = Function.prototype.call;
10595
- return functionCall;
10596
- }
10567
+ Empty.prototype = target.prototype;
10568
+ bound.prototype = new Empty();
10569
+ Empty.prototype = null;
10570
+ }
10571
+ return bound;
10572
+ };
10573
+ var implementation = implementation$1;
10574
+ var functionBind = Function.prototype.bind || implementation;
10575
+ var functionCall = Function.prototype.call;
10597
10576
  var functionApply;
10598
10577
  var hasRequiredFunctionApply;
10599
10578
  function requireFunctionApply() {
@@ -10603,14 +10582,14 @@ function requireFunctionApply() {
10603
10582
  return functionApply;
10604
10583
  }
10605
10584
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
10606
- var bind$3 = requireFunctionBind();
10585
+ var bind$3 = functionBind;
10607
10586
  var $apply$1 = requireFunctionApply();
10608
- var $call$2 = requireFunctionCall();
10587
+ var $call$2 = functionCall;
10609
10588
  var $reflectApply = reflectApply;
10610
10589
  var actualApply = $reflectApply || bind$3.call($call$2, $apply$1);
10611
- var bind$2 = requireFunctionBind();
10590
+ var bind$2 = functionBind;
10612
10591
  var $TypeError$4 = type;
10613
- var $call$1 = requireFunctionCall();
10592
+ var $call$1 = functionCall;
10614
10593
  var $actualApply = actualApply;
10615
10594
  var callBindApplyHelpers = function callBindBasic(args) {
10616
10595
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -10676,8 +10655,8 @@ function requireHasown() {
10676
10655
  hasRequiredHasown = 1;
10677
10656
  var call = Function.prototype.call;
10678
10657
  var $hasOwn = Object.prototype.hasOwnProperty;
10679
- var bind2 = requireFunctionBind();
10680
- hasown = bind2.call(call, $hasOwn);
10658
+ var bind3 = functionBind;
10659
+ hasown = bind3.call(call, $hasOwn);
10681
10660
  return hasown;
10682
10661
  }
10683
10662
  var undefined$1;
@@ -10691,7 +10670,7 @@ var $TypeError$3 = type;
10691
10670
  var $URIError = uri;
10692
10671
  var abs = abs$1;
10693
10672
  var floor = floor$1;
10694
- var max = max$1;
10673
+ var max = max$2;
10695
10674
  var min = min$1;
10696
10675
  var pow = pow$1;
10697
10676
  var round = round$1;
@@ -10725,7 +10704,7 @@ var getProto = requireGetProto();
10725
10704
  var $ObjectGPO = requireObject_getPrototypeOf();
10726
10705
  var $ReflectGPO = requireReflect_getPrototypeOf();
10727
10706
  var $apply = requireFunctionApply();
10728
- var $call = requireFunctionCall();
10707
+ var $call = functionCall;
10729
10708
  var needsEval = {};
10730
10709
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
10731
10710
  var INTRINSICS = {
@@ -10896,7 +10875,7 @@ var LEGACY_ALIASES = {
10896
10875
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
10897
10876
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
10898
10877
  };
10899
- var bind$1 = requireFunctionBind();
10878
+ var bind$1 = functionBind;
10900
10879
  var hasOwn = requireHasown();
10901
10880
  var $concat = bind$1.call($call, Array.prototype.concat);
10902
10881
  var $spliceApply = bind$1.call($apply, Array.prototype.splice);
@@ -15008,7 +14987,7 @@ const admin = adminApi.enhanceEndpoints({
15008
14987
  overrideExisting: false
15009
14988
  });
15010
14989
  const { useInitQuery, useTelemetryPropertiesQuery, useInformationQuery, useProjectSettingsQuery, useUpdateProjectSettingsMutation, useGetPluginsQuery, useGetLicenseLimitsQuery, useGetLicenseTrialTimeLeftQuery, useGetGuidedTourMetaQuery } = admin;
15011
- function bind(fn2, thisArg) {
14990
+ function bind2(fn2, thisArg) {
15012
14991
  return function wrap() {
15013
14992
  return fn2.apply(thisArg, arguments);
15014
14993
  };
@@ -15145,7 +15124,7 @@ function merge2() {
15145
15124
  const extend = (a2, b2, thisArg, { allOwnKeys } = {}) => {
15146
15125
  forEach$1(b2, (val, key) => {
15147
15126
  if (thisArg && isFunction$1(val)) {
15148
- a2[key] = bind(val, thisArg);
15127
+ a2[key] = bind2(val, thisArg);
15149
15128
  } else {
15150
15129
  a2[key] = val;
15151
15130
  }
@@ -17425,7 +17404,7 @@ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
17425
17404
  });
17426
17405
  function createInstance(defaultConfig) {
17427
17406
  const context = new Axios$1(defaultConfig);
17428
- const instance = bind(Axios$1.prototype.request, context);
17407
+ const instance = bind2(Axios$1.prototype.request, context);
17429
17408
  utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
17430
17409
  utils$1.extend(instance, context, null, { allOwnKeys: true });
17431
17410
  instance.create = function create2(instanceConfig) {
@@ -51,7 +51,7 @@ const index = {
51
51
  defaultMessage: "Configuration"
52
52
  },
53
53
  to: `${PLUGIN_ID}`,
54
- Component: () => import("./Settings-O4TWg_hE.mjs")
54
+ Component: () => import("./Settings-C2T_ZvMe.mjs")
55
55
  }
56
56
  );
57
57
  },
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-lDBXYK9v.mjs";
1
+ import { i } from "../_chunks/index-Dl67SY4J.mjs";
2
2
  import "react/jsx-runtime";
3
3
  import "@strapi/design-system";
4
4
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbycrown/strapi-advanced-sitemap",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "keywords": [
5
5
  "strapi",
6
6
  "plugin",
@@ -18,12 +18,7 @@
18
18
  "require": "./dist/admin/index.js",
19
19
  "default": "./dist/admin/index.js"
20
20
  },
21
- "./strapi-server": {
22
- "source": "./server/src/index.js",
23
- "import": "./dist/server/index.mjs",
24
- "require": "./dist/server/index.js",
25
- "default": "./dist/server/index.js"
26
- }
21
+ "./strapi-server": "./strapi-server.js"
27
22
  },
28
23
  "files": [
29
24
  "dist",
@@ -31,9 +26,8 @@
31
26
  "LICENSE"
32
27
  ],
33
28
  "scripts": {
34
- "build": "npm run build:admin && npm run build:server",
29
+ "build": "npm run build:admin",
35
30
  "build:admin": "strapi-plugin build",
36
- "build:server": "node scripts/build-server.js",
37
31
  "watch": "strapi-plugin watch",
38
32
  "watch:link": "strapi-plugin watch:link",
39
33
  "verify": "strapi-plugin verify"
@@ -71,10 +65,6 @@
71
65
  "email": "info@webbycrown.com",
72
66
  "url": "https://webbycrown.com"
73
67
  },
74
- "repository": {
75
- "type": "git",
76
- "url": "https://github.com/webbycrown/strapi-advanced-sitemap.git"
77
- },
78
68
  "engines": {
79
69
  "node": ">=18.0.0",
80
70
  "npm": ">=8.0.0"
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('./src');
@@ -1,6 +0,0 @@
1
- import { createRequire } from 'module';
2
-
3
- const require = createRequire(import.meta.url);
4
- const plugin = require('./src');
5
-
6
- export default plugin;
@@ -1,130 +0,0 @@
1
- 'use strict';
2
-
3
- const PLUGIN_ID = 'strapi-advanced-sitemap';
4
-
5
- const trimSlashes = (value = '') => value.replace(/^\/+/, '').replace(/\/+$/, '');
6
- const { ensureSitemapPermission, ACTIONS, registerSitemapActions } = require('./utils/check-sitemap-permission');
7
-
8
- const getRequestOrigin = (ctx) => {
9
- if (ctx.origin) {
10
- return ctx.origin;
11
- }
12
-
13
- const protocol = ctx.request?.protocol || ctx.protocol || 'http';
14
- const host =
15
- ctx.request?.header?.['x-forwarded-host'] ||
16
- ctx.request?.header?.host ||
17
- ctx.request?.hostname ||
18
- ctx.hostname;
19
-
20
- return `${protocol}://${host}`;
21
- };
22
-
23
- module.exports = async ({ strapi }) => {
24
- await registerSitemapActions();
25
-
26
- strapi.server.use(async (ctx, next) => {
27
- try {
28
- if (ctx.method !== 'GET') {
29
- return next();
30
- }
31
-
32
- const normalizedPath = trimSlashes(ctx.path || '');
33
-
34
- if (!normalizedPath || normalizedPath.startsWith('admin') || normalizedPath.startsWith('api/')) {
35
- return next();
36
- }
37
-
38
- const sitemapService = strapi.plugin(PLUGIN_ID).service('service');
39
-
40
- if (normalizedPath === 'sitemap.xml') {
41
- const allowed = await ensureSitemapPermission(ctx, ACTIONS.root);
42
- if (!allowed) {
43
- return undefined;
44
- }
45
-
46
- const [manualSitemaps, collectionConfigs, configuredBaseUrl] = await Promise.all([
47
- sitemapService.getManualSitemaps(),
48
- sitemapService.getCollectionConfigs(),
49
- sitemapService.getConfiguredBaseUrl(),
50
- ]);
51
-
52
- const origin = getRequestOrigin(ctx);
53
- const apiBaseUrl = `${origin}/api/${PLUGIN_ID}`;
54
- const publicBaseUrl = sitemapService.resolveBaseUrl(configuredBaseUrl, origin);
55
- const xml = sitemapService.buildRootSitemap(manualSitemaps, collectionConfigs, {
56
- apiBaseUrl,
57
- publicBaseUrl,
58
- });
59
-
60
- ctx.set('Content-Type', 'application/xml; charset=utf-8');
61
- ctx.set('Cache-Control', 'no-store');
62
- ctx.body = xml;
63
- return undefined;
64
- }
65
-
66
- if (!normalizedPath.endsWith('.xml')) {
67
- return next();
68
- }
69
-
70
- const segments = normalizedPath.split('/');
71
- const filename = segments.pop();
72
- if (!filename) {
73
- return next();
74
- }
75
-
76
- const basePath = segments.join('/');
77
- const manualSitemaps = await sitemapService.getManualSitemaps();
78
- const target = manualSitemaps.find((item) => {
79
- const storedBase = trimSlashes(item.basePath || '');
80
- const storedFilename = trimSlashes(item.filename || '');
81
- return storedFilename === trimSlashes(filename) && storedBase === basePath;
82
- });
83
-
84
- const configuredBaseUrl = await sitemapService.getConfiguredBaseUrl();
85
- const origin = getRequestOrigin(ctx);
86
- const publicBaseUrl = sitemapService.resolveBaseUrl(configuredBaseUrl, origin);
87
-
88
- if (target) {
89
- const allowed = await ensureSitemapPermission(ctx, ACTIONS.manualFile);
90
- if (!allowed) {
91
- return undefined;
92
- }
93
-
94
- const xml = sitemapService.buildManualSitemapFile(target, publicBaseUrl);
95
- ctx.set('Content-Type', 'application/xml; charset=utf-8');
96
- ctx.set('Cache-Control', 'no-store');
97
- ctx.body = xml;
98
- return undefined;
99
- }
100
-
101
- const collectionConfigs = await sitemapService.getCollectionConfigs();
102
- const collectionTarget = collectionConfigs.find((config) => {
103
- const storedBase = trimSlashes(config.basePath || '');
104
- const storedFilename = trimSlashes(config.filename || '');
105
- return storedFilename === trimSlashes(filename) && storedBase === basePath;
106
- });
107
-
108
- if (!collectionTarget) {
109
- return next();
110
- }
111
-
112
- const allowed = await ensureSitemapPermission(ctx, ACTIONS.collectionFile);
113
- if (!allowed) {
114
- return undefined;
115
- }
116
-
117
- const xml = await sitemapService.buildCollectionSitemapFile(collectionTarget, publicBaseUrl);
118
-
119
- ctx.set('Content-Type', 'application/xml; charset=utf-8');
120
- ctx.set('Cache-Control', 'no-store');
121
- ctx.body = xml;
122
- return undefined;
123
- } catch (error) {
124
- strapi.log.error(`[${PLUGIN_ID}] Failed to serve sitemap: ${error?.message || error}`);
125
- return next();
126
- }
127
- });
128
- };
129
-
130
-
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- default: {},
5
- validator: () => {},
6
- };
7
-
8
-
@@ -1,28 +0,0 @@
1
- {
2
- "schema": {
3
- "collectionName": "strapi_sitemap_content_types",
4
- "info": {
5
- "singularName": "strapi-advanced-sitemap-content-type",
6
- "pluralName": "strapi-advanced-sitemap-content-types",
7
- "displayName": "strapi-advanced-sitemap-content-type"
8
- },
9
- "options": {
10
- "draftAndPublish": false,
11
- "comment": ""
12
- },
13
- "pluginOptions": {
14
- "content-manager": { "visible": false },
15
- "content-type-builder": { "visible": false }
16
- },
17
- "attributes": {
18
- "type": { "type": "string" },
19
- "subPath": { "type": "string" },
20
- "pattern": { "type": "string" },
21
- "priority": { "type": "float" },
22
- "frequency": { "type": "string" },
23
- "lastModified": { "type": "string" },
24
- "basePath": { "type": "string" },
25
- "filename": { "type": "string" }
26
- }
27
- }
28
- }
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- 'strapi-advanced-sitemap-option': require('./option/schema.json'),
5
- 'strapi-advanced-sitemap-content-type': require('./content-type/schema.json'),
6
- 'strapi-advanced-sitemap-single-url': require('./single-url/schema.json'),
7
- };
8
-
9
-