Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sitemap

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitemap - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# 3.2.2
- revert https everywhere added in 3.2.0. xmlns is not url.
- adds alias for lastmod in the form of lastmodiso
- fixes bug in lastmod option for buildSitemapIndex where option would be overwritten if a lastmod option was provided with a single url
- fixes #201, fixes #203
# 3.2.1

@@ -2,0 +7,0 @@ - no really fixes ts errors for real this time

37

dist/lib/sitemap-index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const xmlbuilder_1 = require("xmlbuilder");
const sitemap_1 = require("./sitemap");

@@ -37,16 +38,14 @@ const errors_1 = require("./errors");

function buildSitemapIndex(conf) {
let xml = [];
const root = xmlbuilder_1.create('sitemapindex', { encoding: 'UTF-8' });
let lastmod = '';
xml.push('<?xml version="1.0" encoding="UTF-8"?>');
if (conf.xslUrl) {
xml.push('<?xml-stylesheet type="text/xsl" href="' + conf.xslUrl + '"?>');
root.instructionBefore('xml-stylesheet', `type="text/xsl" href="${conf.xslUrl}"`);
}
if (!conf.xmlNs) {
xml.push('<sitemapindex xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" ' +
'xmlns:mobile="https://www.google.com/schemas/sitemap-mobile/1.0" ' +
'xmlns:image="https://www.google.com/schemas/sitemap-image/1.1" ' +
'xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">');
conf.xmlNs = 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
}
else {
xml.push('<sitemapindex ' + conf.xmlNs + '>');
const ns = conf.xmlNs.split(' ');
for (let attr of ns) {
const [k, v] = attr.split('=');
root.attribute(k, v.replace(/^['"]|['"]$/g, ''));
}

@@ -63,15 +62,19 @@ if (conf.lastmodISO) {

conf.urls.forEach((url) => {
let lm = lastmod;
if (url instanceof Object && url.url) {
lastmod = url.lastmod ? url.lastmod : lastmod;
if (url.lastmod) {
lm = url.lastmod;
}
else if (url.lastmodISO) {
lm = url.lastmodISO;
}
url = url.url;
}
xml.push('<sitemap>');
xml.push('<loc>' + url + '</loc>');
if (lastmod) {
xml.push('<lastmod>' + lastmod + '</lastmod>');
const sm = root.element('sitemap');
sm.element('loc', url);
if (lm) {
sm.element('lastmod', lm);
}
xml.push('</sitemap>');
});
xml.push('</sitemapindex>');
return xml.join('\n');
return root.end();
}

@@ -78,0 +81,0 @@ exports.buildSitemapIndex = buildSitemapIndex;

@@ -174,8 +174,8 @@ "use strict";

if (!this.xmlNs) {
this.root.att('xmlns', 'https://www.sitemaps.org/schemas/sitemap/0.9');
this.root.att('xmlns:news', 'https://www.google.com/schemas/sitemap-news/0.9');
this.root.att('xmlns:xhtml', 'https://www.w3.org/1999/xhtml');
this.root.att('xmlns:mobile', 'https://www.google.com/schemas/sitemap-mobile/1.0');
this.root.att('xmlns:image', 'https://www.google.com/schemas/sitemap-image/1.1');
this.root.att('xmlns:video', 'https://www.google.com/schemas/sitemap-video/1.1');
this.root.att('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
this.root.att('xmlns:news', 'http://www.google.com/schemas/sitemap-news/0.9');
this.root.att('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
this.root.att('xmlns:mobile', 'http://www.google.com/schemas/sitemap-mobile/1.0');
this.root.att('xmlns:image', 'http://www.google.com/schemas/sitemap-image/1.1');
this.root.att('xmlns:video', 'http://www.google.com/schemas/sitemap-video/1.1');
}

@@ -182,0 +182,0 @@ if (this.xslUrl) {

{
"name": "sitemap",
"version": "3.2.1",
"version": "3.2.2",
"description": "Sitemap-generating framework",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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