@cocreate/sitemap 1.2.3 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.2.4](https://github.com/CoCreate-app/CoCreate-sitemap/compare/v1.2.3...v1.2.4) (2024-09-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * undefined changefreq ([a41333f](https://github.com/CoCreate-app/CoCreate-sitemap/commit/a41333f4fa65b18a531a0889211c4a9a04d040ab))
7
+
1
8
  ## [1.2.3](https://github.com/CoCreate-app/CoCreate-sitemap/compare/v1.2.2...v1.2.3) (2024-09-08)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/sitemap",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "A simple sitemap component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "sitemap",
package/src/index.js CHANGED
@@ -99,7 +99,7 @@ class CoCreateSitemap {
99
99
  if (file['content-type'] === 'text/html') {
100
100
  this.parseHtml(file)
101
101
 
102
- if (file.sitemap.type !== 'news') {
102
+ if (file.sitemap.type !== 'news' && file.sitemap.type !== 'image' && file.sitemap.type !== 'video') {
103
103
  if (!file.sitemap.changefreq)
104
104
  file.sitemap.changefreq = 'monthly';
105
105
 
@@ -107,6 +107,9 @@ class CoCreateSitemap {
107
107
  const depth = (file.pathname.match(/\//g) || []).length;
108
108
  file.sitemap.priority = Math.max(0.1, 1.0 - (depth - 1) * 0.1).toFixed(1);
109
109
  }
110
+ } else {
111
+ delete file.sitemap.changefreq
112
+ delete file.sitemap.priority
110
113
  }
111
114
  }
112
115
 
@@ -452,11 +455,11 @@ class CoCreateSitemap {
452
455
 
453
456
  }
454
457
 
455
- if (file.sitemap.type !== 'news') {
458
+ if (file.sitemap.type !== 'news' && file.sitemap.type !== 'image' && file.sitemap.type !== 'video') {
456
459
  const priorityMeta = dom.querySelector('meta[name="sitemap-priority"]');
457
460
  const changefreqMeta = dom.querySelector('meta[name="sitemap-changefreq"]');
458
461
  file.sitemap.priority = priorityMeta ? priorityMeta.getAttribute('content') : file.sitemap.priority; // Default priority if not specified
459
- file.sitemap.changefreq = changefreqMeta ? changefreqMeta.getAttribute('content') : file.sitemap.changefreq; // Default changefreq if not specified
462
+ file.sitemap.changefreq = changefreqMeta ? changefreqMeta.getAttribute('content') : file.sitemap.changefreq || 'monthly'; // Default changefreq if not specified
460
463
  }
461
464
 
462
465
  }