New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cocreate/sitemap

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/sitemap - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.2.3](https://github.com/CoCreate-app/CoCreate-sitemap/compare/v1.2.2...v1.2.3) (2024-09-08)
### Bug Fixes
* encodeValues for characters xml cant parse. Format date correctly ([e928405](https://github.com/CoCreate-app/CoCreate-sitemap/commit/e928405998d5f7492acdd1bb35c67f44c9bce4ad))
## [1.2.2](https://github.com/CoCreate-app/CoCreate-sitemap/compare/v1.2.1...v1.2.2) (2024-09-01)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "@cocreate/sitemap",
"version": "1.2.2",
"version": "1.2.3",
"description": "A simple sitemap component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -62,4 +62,3 @@ /********************************************************************************

// TODO: need to get info such as host
const entry = this.createEntry(file);
const entry = this.createEntry(file, host);

@@ -105,3 +104,3 @@ let { mainSitemap, sitemap } = await this.getSitemap(file, host);

if (file.sitemap.type !== 'news') {
if (file.sitemap.changefreq)
if (!file.sitemap.changefreq)
file.sitemap.changefreq = 'monthly';

@@ -121,2 +120,3 @@

continue
let value = file.sitemap[key];

@@ -127,2 +127,3 @@

value = [value]
for (let i = 0; i < value.length; i++) {

@@ -132,4 +133,3 @@ entry += `\t\t<${key}:${key}>\n`;

for (const nestedKey of Object.keys(value[i])) {
const nestedValue = value[i][nestedKey];
let nestedValue = value[i][nestedKey];
// Handle nested objects

@@ -144,2 +144,12 @@ if (typeof nestedValue === 'object' && nestedValue !== null && !(nestedValue instanceof Date)) {

} else {
if (nestedKey === 'loc') {
if (!nestedValue.startsWith('https://') && !nestedValue.startsWith('http://') && !nestedValue.startsWith('{{$host}}')) {
nestedValue = `{{$host}}${nestedValue}`;
}
} else if (nestedKey === 'publication_date') {
nestedValue = new Date(nestedValue).toISOString().split('.')[0] + "Z";
} else {
nestedValue = this.encodeXML(nestedValue)
}
entry += `\t\t\t<${key}:${nestedKey}>${nestedValue}</${key}:${nestedKey}>\n`;

@@ -152,2 +162,12 @@ }

} else {
if (key === 'loc') {
if (!value.startsWith('https://') && !value.startsWith('http://')) {
value = `{{$host}}${value}`;
}
} else if (key === 'lastmod') {
value = new Date(file.modified.on).toISOString().split('.')[0] + "Z";
} else {
value = this.encodeXML(value)
}
entry += `\t\t<${key}>${value}</${key}>\n`;

@@ -450,4 +470,15 @@ }

}
encodeXML(str) {
if (str)
return str
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;');
}
}
module.exports = CoCreateSitemap;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc