@webbycrown/strapi-advanced-sitemap 1.0.3
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/LICENSE +23 -0
- package/README.md +194 -0
- package/dist/_chunks/Settings-CDmtmOAh.js +26522 -0
- package/dist/_chunks/Settings-O4TWg_hE.mjs +26503 -0
- package/dist/_chunks/en-B2cxOPRT.mjs +104 -0
- package/dist/_chunks/en-DXDFX_Yk.js +104 -0
- package/dist/_chunks/index-D0n235aN.js +83 -0
- package/dist/_chunks/index-lDBXYK9v.mjs +84 -0
- package/dist/admin/index.js +5 -0
- package/dist/admin/index.mjs +6 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.mjs +6 -0
- package/dist/server/src/bootstrap.js +130 -0
- package/dist/server/src/config/index.js +8 -0
- package/dist/server/src/content-types/content-type/schema.json +28 -0
- package/dist/server/src/content-types/index.js +9 -0
- package/dist/server/src/content-types/option/schema.json +22 -0
- package/dist/server/src/content-types/single-url/schema.json +23 -0
- package/dist/server/src/controllers/controller.js +209 -0
- package/dist/server/src/controllers/index.js +7 -0
- package/dist/server/src/destroy.js +7 -0
- package/dist/server/src/index.js +27 -0
- package/dist/server/src/middlewares/index.js +7 -0
- package/dist/server/src/middlewares/permission-check.js +20 -0
- package/dist/server/src/policies/index.js +5 -0
- package/dist/server/src/register.js +8 -0
- package/dist/server/src/routes/index.js +74 -0
- package/dist/server/src/services/index.js +7 -0
- package/dist/server/src/services/service.js +371 -0
- package/dist/server/src/utils/check-sitemap-permission.js +139 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 WebbyCrown
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# 🚀 Strapi Advanced Sitemap
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@webbycrown/strapi-advanced-sitemap)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://strapi.io/)
|
|
6
|
+
|
|
7
|
+
SEO-ready XML sitemaps for Strapi CMS. Create manual URL sets or sitemap indexes, generate dynamic feeds from collection types, and expose every endpoint behind role-based permissions—no external services required.
|
|
8
|
+
|
|
9
|
+
📦 **NPM Package**: [@webbycrown/strapi-advanced-sitemap](https://www.npmjs.com/package/@webbycrown/strapi-advanced-sitemap)
|
|
10
|
+
💻 **Repository**: [GitHub – webbycrown/strapi-advanced-sitemap](https://github.com/webbycrown/strapi-advanced-sitemap)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ✨ Features
|
|
15
|
+
|
|
16
|
+
### 🗂️ Manual Sitemap Builder
|
|
17
|
+
- **Single sitemap (`<urlset>`):** curate individual URLs with optional priority values
|
|
18
|
+
- **Sitemap index (`<sitemapindex>`):** reference other sitemap files (internal or external)
|
|
19
|
+
- **Automatic URL resolution:** combine relative paths with your site base URL
|
|
20
|
+
- **UI hints & validation:** friendly helper text, required field checks, URL previews
|
|
21
|
+
|
|
22
|
+
### 🔁 Dynamic Collection Sitemaps
|
|
23
|
+
- **Pattern-based URLs:** use tokens like `/blog/[slug]` (supports nested fields)
|
|
24
|
+
- **Entry prefix & base path:** compose clean URLs without extra middleware
|
|
25
|
+
- **Frequency, priority, lastmod:** configure crawl metadata per sitemap
|
|
26
|
+
- **Draft filtering:** includes only published entries from Draft & Publish collections
|
|
27
|
+
|
|
28
|
+
### 🔒 Permission-Aware Delivery
|
|
29
|
+
- **Role gating:** every endpoint maps to an action (`plugin::strapi-advanced-sitemap.controller.*`)
|
|
30
|
+
- **Public crawler control:** enable only the endpoints you want search engines to reach
|
|
31
|
+
- **API token support:** respect token-bound permissions for programmatic access
|
|
32
|
+
|
|
33
|
+
### 🛠️ Admin-First Workflow
|
|
34
|
+
- **Inline editing:** manage everything from Settings → Strapi Advanced Sitemap
|
|
35
|
+
- **Frontend base URL control:** store the live site origin once and reuse it across manual and collection previews
|
|
36
|
+
- **Instant feedback:** clear success/error messages plus live URL previews for every manual entry
|
|
37
|
+
- **No redeploys:** sitemap definitions are stored in Strapi entities
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 📸 Feature Screens
|
|
42
|
+
|
|
43
|
+
### Configure Sitemap Page
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
### Permissions in Public Role Screen
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
### Manual Sitemap Settings (Sitemap Index)
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
### Manual Sitemap Settings (URL Set)
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
### Collection Sitemap Settings
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
### Collection Sitemap Entry
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🛠️ Installation
|
|
64
|
+
|
|
65
|
+
### Via npm
|
|
66
|
+
```bash
|
|
67
|
+
npm install @webbycrown/strapi-advanced-sitemap
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Via yarn
|
|
71
|
+
```bash
|
|
72
|
+
yarn add @webbycrown/strapi-advanced-sitemap
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Enable the plugin
|
|
76
|
+
Update `config/plugins.js`:
|
|
77
|
+
```js
|
|
78
|
+
module.exports = {
|
|
79
|
+
'strapi-advanced-sitemap': {
|
|
80
|
+
enabled: true,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Restart Strapi and rebuild the admin panel:
|
|
86
|
+
```bash
|
|
87
|
+
npm run build
|
|
88
|
+
npm run develop
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## ⚡ Quick Start
|
|
94
|
+
|
|
95
|
+
1. **Open the admin panel** → *Settings → Strapi Advanced Sitemap*
|
|
96
|
+
2. **Add a manual sitemap** (single or index) and configure filename/base path
|
|
97
|
+
3. **Add entries**
|
|
98
|
+
- Single sitemap: supply URLs (relative or absolute) + optional priorities
|
|
99
|
+
- Index sitemap: supply links to other sitemap files
|
|
100
|
+
4. **Add a collection sitemap**: pick a collection type, define a pattern (e.g. `/articles/[slug]`), and adjust metadata
|
|
101
|
+
5. **Grant permissions**: Settings → Users & Permissions → Roles → Public (or another role) → enable the sitemap actions:
|
|
102
|
+
- `serveRootSitemap`
|
|
103
|
+
- `serveManualSitemapIndex`
|
|
104
|
+
- `serveManualSitemapFile`
|
|
105
|
+
- `serveCollectionSitemapFile`
|
|
106
|
+
|
|
107
|
+
### Available Endpoints
|
|
108
|
+
- `/sitemap.xml` – root sitemap index (manual + collection entries)
|
|
109
|
+
- `/sitemaps/manual-sitemaps` – manual sitemap index (if configured)
|
|
110
|
+
- `/sitemaps/{filename}.xml` – individual manual sitemap files
|
|
111
|
+
- `/api/strapi-advanced-sitemap/collection-sitemaps/{id}.xml` – collection XML (also linked from the root)
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 🧭 Manual Sitemap Types
|
|
116
|
+
|
|
117
|
+
| Type | Emits | When to use | Entry expectations |
|
|
118
|
+
|------|-------|-------------|--------------------|
|
|
119
|
+
| **Single sitemap** | `<urlset>` | Hand-curated URLs (blogs, landing pages) | Each entry is a path or absolute URL; optional priority |
|
|
120
|
+
| **Sitemap index** | `<sitemapindex>` | Aggregate internal/external sitemap files | Each entry points to another sitemap file |
|
|
121
|
+
|
|
122
|
+
Relative paths are automatically combined with your configured base URL and per-sitemap base path.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🧱 Collection Sitemap Patterns
|
|
127
|
+
|
|
128
|
+
- Use `[fieldName]` tokens (nested allowed: `[author.slug]`) to build URLs
|
|
129
|
+
- Combine with “Entry prefix” or “Base path” to match your routing strategy
|
|
130
|
+
- `lastmod` draws from `updatedAt`, `publishedAt`, or `createdAt`
|
|
131
|
+
- Draft entries are excluded when Draft & Publish is enabled
|
|
132
|
+
|
|
133
|
+
Example pattern:
|
|
134
|
+
```
|
|
135
|
+
/articles/[slug]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🔐 Permissions & Security
|
|
141
|
+
|
|
142
|
+
- Actions live under `plugin::strapi-advanced-sitemap.*`
|
|
143
|
+
- Denied roles receive `401 Unauthorized` responses
|
|
144
|
+
- API tokens respect the same action mapping
|
|
145
|
+
- Manual sitemaps store relative paths only—final URLs are resolved server side
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 🧪 Troubleshooting
|
|
150
|
+
|
|
151
|
+
| Symptom | Fix |
|
|
152
|
+
|---------|-----|
|
|
153
|
+
| Sitemap returns 401 | Enable the corresponding plugin actions for that role |
|
|
154
|
+
| Manual sitemap URL 404s | Check filename + base path, ensure “Save changes” was clicked |
|
|
155
|
+
| Collection sitemap empty | Verify entries are published and the pattern resolves without leftover tokens |
|
|
156
|
+
| Admin UI stale | Run `npm run build` and restart Strapi |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 📝 License
|
|
161
|
+
|
|
162
|
+
MIT – see [LICENSE](LICENSE) for details.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🆘 Support
|
|
167
|
+
|
|
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
|
|
172
|
+
|
|
173
|
+
## 🙏 Acknowledgments
|
|
174
|
+
|
|
175
|
+
- Built for the amazing [Strapi](https://strapi.io/) community
|
|
176
|
+
- Inspired by modern form design principles
|
|
177
|
+
- Thanks to all contributors and users
|
|
178
|
+
|
|
179
|
+
## 📊 Changelog
|
|
180
|
+
|
|
181
|
+
### v1.0.0
|
|
182
|
+
- ✨ Initial release of **Strapi Advanced Sitemap**
|
|
183
|
+
- 🧭 Manual sitemap builder supporting URL sets and sitemap indexes
|
|
184
|
+
- ⚙️ Dynamic collection sitemaps powered by pattern tokens
|
|
185
|
+
- 🔐 Role-based access control for each sitemap endpoint
|
|
186
|
+
- 🌍 Configurable frontend base URL with live preview inside the admin panel
|
|
187
|
+
- 📦 Easy integration and management from Strapi settings
|
|
188
|
+
- 🚀 Published to NPM: [@webbycrown/strapi-advanced-sitemap](https://www.npmjs.com/package/@webbycrown/strapi-advanced-sitemap)
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
<div align="center">
|
|
193
|
+
<strong>Made with ❤️ by <a href="https://webbycrown.com">WebbyCrown</a></strong>
|
|
194
|
+
</div>
|