@webbycrown/strapi-advanced-sitemap 1.0.3 → 1.0.4

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://img.youtube.com/vi/4HBuf8fhNCQ/hqdefault.jpg)](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,58 @@ 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
+ ### v1.0.4
182
+
183
+ - 📝 Updated README to include Demo Video section
184
+ - ⚡ Improved documentation clarity for plugin setup and usage
185
+
186
+ ### v1.0.3
187
+
188
+ - 🐛 Fixed bugs.
189
+ - 🛠️ Resolved minor issues affecting
167
190
 
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
191
+ ### v1.0.2
172
192
 
173
- ## 🙏 Acknowledgments
193
+ - 📝 README documentation updates
174
194
 
175
- - Built for the amazing [Strapi](https://strapi.io/) community
176
- - Inspired by modern form design principles
177
- - Thanks to all contributors and users
195
+ ### v1.0.1
178
196
 
179
- ## 📊 Changelog
197
+ - 📝 README documentation updates
198
+ - ✨ Improved helper text and UI hints in admin settings
180
199
 
181
200
  ### v1.0.0
182
- - ✨ Initial release of **Strapi Advanced Sitemap**
201
+
202
+ - ✨ Initial release of Strapi Advanced Sitemap
183
203
  - 🧭 Manual sitemap builder supporting URL sets and sitemap indexes
184
204
  - ⚙️ Dynamic collection sitemaps powered by pattern tokens
185
205
  - 🔐 Role-based access control for each sitemap endpoint
186
206
  - 🌍 Configurable frontend base URL with live preview inside the admin panel
187
207
  - 📦 Easy integration and management from Strapi settings
188
- - 🚀 Published to NPM: [@webbycrown/strapi-advanced-sitemap](https://www.npmjs.com/package/@webbycrown/strapi-advanced-sitemap)
208
+ - 🚀 Published to NPM: @webbycrown/strapi-advanced-sitemap
209
+
210
+ ---
211
+
212
+ ## 📝 License
213
+
214
+ MIT – see [LICENSE](LICENSE) for details.
189
215
 
190
216
  ---
191
217
 
192
218
  <div align="center">
193
- <strong>Made with ❤️ by <a href="https://webbycrown.com">WebbyCrown</a></strong>
219
+ <strong>Crafted with ❤️ by <a href="https://webbycrown.com">WebbyCrown</a></strong>
194
220
  </div>
221
+
222
+
@@ -9,7 +9,7 @@ const ReactDOM = require("react-dom");
9
9
  const reactIntl = require("react-intl");
10
10
  require("@strapi/icons/symbols");
11
11
  const styled = require("styled-components");
12
- const index = require("./index-D0n235aN.js");
12
+ const index = require("./index-DYdeQf3Q.js");
13
13
  const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
14
14
  function _interopNamespace(e2) {
15
15
  if (e2 && e2.__esModule) return e2;
@@ -10005,7 +10005,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
10005
10005
  var ys = arrObjKeys(obj, inspect2);
10006
10006
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
10007
10007
  var protoTag = obj instanceof Object ? "" : "null prototype";
10008
- var stringTag2 = !isPlainObject2 && toStringTag$1 && Object(obj) === obj && toStringTag$1 in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
10008
+ var stringTag2 = !isPlainObject2 && toStringTag$1 && Object(obj) === obj && toStringTag$1 in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
10009
10009
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
10010
10010
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
10011
10011
  if (ys.length === 0) {
@@ -10030,25 +10030,25 @@ function canTrustToString(obj) {
10030
10030
  return !toStringTag$1 || !(typeof obj === "object" && (toStringTag$1 in obj || typeof obj[toStringTag$1] !== "undefined"));
10031
10031
  }
10032
10032
  function isArray$4(obj) {
10033
- return toStr(obj) === "[object Array]" && canTrustToString(obj);
10033
+ return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
10034
10034
  }
10035
10035
  function isDate$2(obj) {
10036
- return toStr(obj) === "[object Date]" && canTrustToString(obj);
10036
+ return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
10037
10037
  }
10038
10038
  function isRegExp$2(obj) {
10039
- return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
10039
+ return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
10040
10040
  }
10041
10041
  function isError(obj) {
10042
- return toStr(obj) === "[object Error]" && canTrustToString(obj);
10042
+ return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
10043
10043
  }
10044
10044
  function isString$1(obj) {
10045
- return toStr(obj) === "[object String]" && canTrustToString(obj);
10045
+ return toStr$1(obj) === "[object String]" && canTrustToString(obj);
10046
10046
  }
10047
10047
  function isNumber$1(obj) {
10048
- return toStr(obj) === "[object Number]" && canTrustToString(obj);
10048
+ return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
10049
10049
  }
10050
10050
  function isBoolean$1(obj) {
10051
- return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
10051
+ return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
10052
10052
  }
10053
10053
  function isSymbol(obj) {
10054
10054
  if (hasShammedSymbols) {
@@ -10084,7 +10084,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
10084
10084
  function has$5(obj, key) {
10085
10085
  return hasOwn$1.call(obj, key);
10086
10086
  }
10087
- function toStr(obj) {
10087
+ function toStr$1(obj) {
10088
10088
  return objectToString.call(obj);
10089
10089
  }
10090
10090
  function nameOf(f2) {
@@ -10393,7 +10393,7 @@ var syntax = SyntaxError;
10393
10393
  var uri = URIError;
10394
10394
  var abs$1 = Math.abs;
10395
10395
  var floor$1 = Math.floor;
10396
- var max$1 = Math.max;
10396
+ var max$2 = Math.max;
10397
10397
  var min$1 = Math.min;
10398
10398
  var pow$1 = Math.pow;
10399
10399
  var round$1 = Math.round;
@@ -10522,99 +10522,78 @@ function requireObject_getPrototypeOf() {
10522
10522
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
10523
10523
  return Object_getPrototypeOf;
10524
10524
  }
10525
- var implementation;
10526
- var hasRequiredImplementation;
10527
- function requireImplementation() {
10528
- if (hasRequiredImplementation) return implementation;
10529
- hasRequiredImplementation = 1;
10530
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
10531
- var toStr2 = Object.prototype.toString;
10532
- var max2 = Math.max;
10533
- var funcType = "[object Function]";
10534
- var concatty = function concatty2(a2, b2) {
10535
- var arr = [];
10536
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
10537
- arr[i2] = a2[i2];
10538
- }
10539
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
10540
- arr[j2 + a2.length] = b2[j2];
10541
- }
10542
- return arr;
10543
- };
10544
- var slicy = function slicy2(arrLike, offset) {
10545
- var arr = [];
10546
- for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
10547
- arr[j2] = arrLike[i2];
10525
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
10526
+ var toStr = Object.prototype.toString;
10527
+ var max$1 = Math.max;
10528
+ var funcType = "[object Function]";
10529
+ var concatty = function concatty2(a2, b2) {
10530
+ var arr = [];
10531
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
10532
+ arr[i2] = a2[i2];
10533
+ }
10534
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
10535
+ arr[j2 + a2.length] = b2[j2];
10536
+ }
10537
+ return arr;
10538
+ };
10539
+ var slicy = function slicy2(arrLike, offset) {
10540
+ var arr = [];
10541
+ for (var i2 = offset, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
10542
+ arr[j2] = arrLike[i2];
10543
+ }
10544
+ return arr;
10545
+ };
10546
+ var joiny = function(arr, joiner) {
10547
+ var str = "";
10548
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
10549
+ str += arr[i2];
10550
+ if (i2 + 1 < arr.length) {
10551
+ str += joiner;
10548
10552
  }
10549
- return arr;
10550
- };
10551
- var joiny = function(arr, joiner) {
10552
- var str = "";
10553
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
10554
- str += arr[i2];
10555
- if (i2 + 1 < arr.length) {
10556
- str += joiner;
10553
+ }
10554
+ return str;
10555
+ };
10556
+ var implementation$1 = function bind(that) {
10557
+ var target = this;
10558
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
10559
+ throw new TypeError(ERROR_MESSAGE + target);
10560
+ }
10561
+ var args = slicy(arguments, 1);
10562
+ var bound;
10563
+ var binder = function() {
10564
+ if (this instanceof bound) {
10565
+ var result = target.apply(
10566
+ this,
10567
+ concatty(args, arguments)
10568
+ );
10569
+ if (Object(result) === result) {
10570
+ return result;
10557
10571
  }
10572
+ return this;
10558
10573
  }
10559
- return str;
10574
+ return target.apply(
10575
+ that,
10576
+ concatty(args, arguments)
10577
+ );
10560
10578
  };
10561
- implementation = function bind2(that) {
10562
- var target = this;
10563
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
10564
- throw new TypeError(ERROR_MESSAGE + target);
10565
- }
10566
- var args = slicy(arguments, 1);
10567
- var bound;
10568
- var binder = function() {
10569
- if (this instanceof bound) {
10570
- var result = target.apply(
10571
- this,
10572
- concatty(args, arguments)
10573
- );
10574
- if (Object(result) === result) {
10575
- return result;
10576
- }
10577
- return this;
10578
- }
10579
- return target.apply(
10580
- that,
10581
- concatty(args, arguments)
10582
- );
10579
+ var boundLength = max$1(0, target.length - args.length);
10580
+ var boundArgs = [];
10581
+ for (var i2 = 0; i2 < boundLength; i2++) {
10582
+ boundArgs[i2] = "$" + i2;
10583
+ }
10584
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
10585
+ if (target.prototype) {
10586
+ var Empty = function Empty2() {
10583
10587
  };
10584
- var boundLength = max2(0, target.length - args.length);
10585
- var boundArgs = [];
10586
- for (var i2 = 0; i2 < boundLength; i2++) {
10587
- boundArgs[i2] = "$" + i2;
10588
- }
10589
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
10590
- if (target.prototype) {
10591
- var Empty = function Empty2() {
10592
- };
10593
- Empty.prototype = target.prototype;
10594
- bound.prototype = new Empty();
10595
- Empty.prototype = null;
10596
- }
10597
- return bound;
10598
- };
10599
- return implementation;
10600
- }
10601
- var functionBind;
10602
- var hasRequiredFunctionBind;
10603
- function requireFunctionBind() {
10604
- if (hasRequiredFunctionBind) return functionBind;
10605
- hasRequiredFunctionBind = 1;
10606
- var implementation2 = requireImplementation();
10607
- functionBind = Function.prototype.bind || implementation2;
10608
- return functionBind;
10609
- }
10610
- var functionCall;
10611
- var hasRequiredFunctionCall;
10612
- function requireFunctionCall() {
10613
- if (hasRequiredFunctionCall) return functionCall;
10614
- hasRequiredFunctionCall = 1;
10615
- functionCall = Function.prototype.call;
10616
- return functionCall;
10617
- }
10588
+ Empty.prototype = target.prototype;
10589
+ bound.prototype = new Empty();
10590
+ Empty.prototype = null;
10591
+ }
10592
+ return bound;
10593
+ };
10594
+ var implementation = implementation$1;
10595
+ var functionBind = Function.prototype.bind || implementation;
10596
+ var functionCall = Function.prototype.call;
10618
10597
  var functionApply;
10619
10598
  var hasRequiredFunctionApply;
10620
10599
  function requireFunctionApply() {
@@ -10624,14 +10603,14 @@ function requireFunctionApply() {
10624
10603
  return functionApply;
10625
10604
  }
10626
10605
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
10627
- var bind$3 = requireFunctionBind();
10606
+ var bind$3 = functionBind;
10628
10607
  var $apply$1 = requireFunctionApply();
10629
- var $call$2 = requireFunctionCall();
10608
+ var $call$2 = functionCall;
10630
10609
  var $reflectApply = reflectApply;
10631
10610
  var actualApply = $reflectApply || bind$3.call($call$2, $apply$1);
10632
- var bind$2 = requireFunctionBind();
10611
+ var bind$2 = functionBind;
10633
10612
  var $TypeError$4 = type;
10634
- var $call$1 = requireFunctionCall();
10613
+ var $call$1 = functionCall;
10635
10614
  var $actualApply = actualApply;
10636
10615
  var callBindApplyHelpers = function callBindBasic(args) {
10637
10616
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -10697,8 +10676,8 @@ function requireHasown() {
10697
10676
  hasRequiredHasown = 1;
10698
10677
  var call = Function.prototype.call;
10699
10678
  var $hasOwn = Object.prototype.hasOwnProperty;
10700
- var bind2 = requireFunctionBind();
10701
- hasown = bind2.call(call, $hasOwn);
10679
+ var bind3 = functionBind;
10680
+ hasown = bind3.call(call, $hasOwn);
10702
10681
  return hasown;
10703
10682
  }
10704
10683
  var undefined$1;
@@ -10712,7 +10691,7 @@ var $TypeError$3 = type;
10712
10691
  var $URIError = uri;
10713
10692
  var abs = abs$1;
10714
10693
  var floor = floor$1;
10715
- var max = max$1;
10694
+ var max = max$2;
10716
10695
  var min = min$1;
10717
10696
  var pow = pow$1;
10718
10697
  var round = round$1;
@@ -10746,7 +10725,7 @@ var getProto = requireGetProto();
10746
10725
  var $ObjectGPO = requireObject_getPrototypeOf();
10747
10726
  var $ReflectGPO = requireReflect_getPrototypeOf();
10748
10727
  var $apply = requireFunctionApply();
10749
- var $call = requireFunctionCall();
10728
+ var $call = functionCall;
10750
10729
  var needsEval = {};
10751
10730
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
10752
10731
  var INTRINSICS = {
@@ -10917,7 +10896,7 @@ var LEGACY_ALIASES = {
10917
10896
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
10918
10897
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
10919
10898
  };
10920
- var bind$1 = requireFunctionBind();
10899
+ var bind$1 = functionBind;
10921
10900
  var hasOwn = requireHasown();
10922
10901
  var $concat = bind$1.call($call, Array.prototype.concat);
10923
10902
  var $spliceApply = bind$1.call($apply, Array.prototype.splice);
@@ -15029,7 +15008,7 @@ const admin = adminApi.enhanceEndpoints({
15029
15008
  overrideExisting: false
15030
15009
  });
15031
15010
  const { useInitQuery, useTelemetryPropertiesQuery, useInformationQuery, useProjectSettingsQuery, useUpdateProjectSettingsMutation, useGetPluginsQuery, useGetLicenseLimitsQuery, useGetLicenseTrialTimeLeftQuery, useGetGuidedTourMetaQuery } = admin;
15032
- function bind(fn2, thisArg) {
15011
+ function bind2(fn2, thisArg) {
15033
15012
  return function wrap() {
15034
15013
  return fn2.apply(thisArg, arguments);
15035
15014
  };
@@ -15166,7 +15145,7 @@ function merge2() {
15166
15145
  const extend = (a2, b2, thisArg, { allOwnKeys } = {}) => {
15167
15146
  forEach$1(b2, (val, key) => {
15168
15147
  if (thisArg && isFunction$1(val)) {
15169
- a2[key] = bind(val, thisArg);
15148
+ a2[key] = bind2(val, thisArg);
15170
15149
  } else {
15171
15150
  a2[key] = val;
15172
15151
  }
@@ -17446,7 +17425,7 @@ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
17446
17425
  });
17447
17426
  function createInstance(defaultConfig) {
17448
17427
  const context = new Axios$1(defaultConfig);
17449
- const instance = bind(Axios$1.prototype.request, context);
17428
+ const instance = bind2(Axios$1.prototype.request, context);
17450
17429
  utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
17451
17430
  utils$1.extend(instance, context, null, { allOwnKeys: true });
17452
17431
  instance.create = function create2(instanceConfig) {
@@ -52,7 +52,7 @@ const index = {
52
52
  defaultMessage: "Configuration"
53
53
  },
54
54
  to: `${PLUGIN_ID}`,
55
- Component: () => Promise.resolve().then(() => require("./Settings-CDmtmOAh.js"))
55
+ Component: () => Promise.resolve().then(() => require("./Settings-BA3_-WUh.js"))
56
56
  }
57
57
  );
58
58
  },
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-D0n235aN.js");
2
+ const index = require("../_chunks/index-DYdeQf3Q.js");
3
3
  require("react/jsx-runtime");
4
4
  require("@strapi/design-system");
5
5
  module.exports = index.index;
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.4",
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
-