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 0.7.4 to 0.8.0

bower.json

43

lib/sitemap.js

@@ -53,3 +53,4 @@ /*!

if ( conf['lastmod'] ) {
// append the timezone offset so that dates are treated as local time. Otherwise the Unit tests fail sometimes.
// append the timezone offset so that dates are treated as local time.
// Otherwise the Unit tests fail sometimes.
var timezoneOffset = 'UTC-' + (new Date().getTimezoneOffset()/60) + '00';

@@ -63,5 +64,10 @@ var dt = new Date( conf['lastmod'] + ' ' + timezoneOffset );

this.lastmod += 'T';
this.lastmod += [ ut.lpad ( dt.getHours (), 2 ), ut.lpad ( dt.getMinutes (), 2 ), ut.lpad ( dt.getSeconds (), 2 ) ].join ( ':' );
this.lastmod += ( dt.getTimezoneOffset () >= 0 ? '+' : '' );
this.lastmod += [ ut.lpad ( parseInt ( dt.getTimezoneOffset () / 60, 10 ), 2 ), ut.lpad ( dt.getTimezoneOffset () % 60, 2 ) ].join ( ':' );
this.lastmod += [ ut.lpad(dt.getHours(), 2),
ut.lpad(dt.getMinutes(), 2),
ut.lpad(dt.getSeconds(), 2)
].join(':');
this.lastmod += ( dt.getTimezoneOffset() >= 0 ? '+' : '');
this.lastmod += [ ut.lpad(parseInt(dt.getTimezoneOffset()/60, 10 ), 2),
ut.lpad(dt.getTimezoneOffset() % 60, 2)
].join ( ':' );
}

@@ -88,2 +94,4 @@ } else if ( conf['lastmodISO'] ) {

}
this.img = conf['img'] || null;
}

@@ -105,5 +113,5 @@

// result xml
var xml = '<url> {loc} {lastmod} {changefreq} {priority} </url>'
var xml = '<url> {loc} {img} {lastmod} {changefreq} {priority} </url>'
// xml property
, props = ['loc', 'lastmod', 'changefreq', 'priority']
, props = ['loc', 'img', 'lastmod', 'changefreq', 'priority']
// property array size (for loop)

@@ -117,3 +125,6 @@ , ps = props.length

if (this[p]) {
if(this[p] && p == 'img') {
xml = xml.replace('{' + p + '}',
'<image:image><image:loc>'+this[p]+'</image:loc></image:image>');
} else if (this[p]) {
xml = xml.replace('{'+p+'}',

@@ -124,2 +135,3 @@ '<'+p+'>'+this[p]+'</'+p+'>');

}
xml = xml.replace(' ', ' ');
}

@@ -253,3 +265,5 @@

, xml = [ '<?xml version="1.0" encoding="UTF-8"?>',
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'];
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" ' +
'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'
];

@@ -295,3 +309,9 @@ if (this.isCacheValid()) {

function createSitemapIndex(conf) {
return new SitemapIndex(conf.urls, conf.targetFolder, conf.hostname, conf.cacheTime, conf.sitemapName, conf.sitemapSize, conf.callback);
return new SitemapIndex(conf.urls,
conf.targetFolder,
conf.hostname,
conf.cacheTime,
conf.sitemapName,
conf.sitemapSize,
conf.callback);
}

@@ -378,3 +398,3 @@

xml.push('<?xml version="1.0" encoding="UTF-8"?>');
xml.push('<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
xml.push('<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">');

@@ -390,3 +410,4 @@ self.sitemaps.forEach( function (sitemap, index) {

var stream = self.fs.createWriteStream(targetFolder + '/' + self.sitemapName + '-index.xml');
var stream = self.fs.createWriteStream(targetFolder + '/' +
self.sitemapName + '-index.xml');
stream.once('open', function(fd) {

@@ -393,0 +414,0 @@ stream.write(xml.join('\n'));

@@ -7,2 +7,4 @@ /*!

var _ = require('underscore');
/**

@@ -66,7 +68,7 @@ * Exit with the given `str`.

exports.chunkArray = function(arr, chunkSize) {
return [].concat.apply([],
arr.map(function(elem,i) {
return i%chunkSize ? [] : [arr.slice(i,i+chunkSize)];
})
);
var lists = _.groupBy(arr, function(element, index) {
return Math.floor(index/chunkSize);
});
lists = _.toArray(lists);
return lists;
}

@@ -76,2 +78,2 @@

return (new Date()).getTime();
}
}
{
"name": "sitemap",
"version": "0.7.4",
"version": "0.8.0",
"description": "Sitemap-generating framework",

@@ -9,3 +9,4 @@ "keywords": ["sitemap", "sitemap.xml"],

"devDependencies": {
"expresso": "^0.9.2"
"expresso": "^0.9.2",
"underscore": "1.7.0"
},

@@ -12,0 +13,0 @@ "main": "index",

@@ -30,3 +30,4 @@ sitemap.js

{ url: '/page-2/', changefreq: 'monthly', priority: 0.7 },
{ url: '/page-3/' } // changefreq: 'weekly', priority: 0.5
{ url: '/page-3/'}, // changefreq: 'weekly', priority: 0.5
{ url: '/page-4/, img: "http://urlTest.com" }
]

@@ -33,0 +34,0 @@ });

@@ -32,2 +32,3 @@ /*!

'url': url,
'img': "http://urlTest.com",
'lastmod': '2011-06-27',

@@ -41,2 +42,7 @@ 'changefreq': 'always',

'<loc>http://ya.ru</loc> '+
'<image:image>'+
'<image:loc>'+
'http://urlTest.com'+
'</image:loc>'+
'</image:image> '+
'<lastmod>2011-06-27</lastmod> '+

@@ -68,2 +74,3 @@ '<changefreq>always</changefreq> '+

'url': url,
'img': "http://urlTest.com",
'lastmod': '2011-06-27',

@@ -77,2 +84,7 @@ 'changefreq': 'always',

'<loc>http://ya.ru</loc> '+
'<image:image>'+
'<image:loc>'+
'http://urlTest.com'+
'</image:loc>'+
'</image:image> '+
'<lastmod>2011-06-27</lastmod> '+

@@ -101,3 +113,3 @@ '<changefreq>always</changefreq> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -118,3 +130,3 @@ '<loc>http://ya.ru</loc> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -137,3 +149,3 @@ '<loc>http://ya.ru</loc> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -154,3 +166,3 @@ '<loc>http://ya.ru</loc> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -217,3 +229,3 @@ '<loc>http://ya.ru</loc> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -272,3 +284,3 @@ '<loc>http://test.com/</loc> '+

, xml = '<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -294,3 +306,3 @@ '<loc>http://test.com/page-1/</loc> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -318,3 +330,3 @@ '<loc>http://test.com/page-1/</loc> '+

, xml = '<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -333,3 +345,3 @@ '<loc>http://test.com/page-1/</loc> '+

'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -355,3 +367,3 @@ '<loc>http://test.com/page-1/</loc> '+

, xml = '<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -375,3 +387,3 @@ '<loc>http://test.com/page-that-mentions-http:-in-the-url/</loc> '+

, xml = '<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -400,3 +412,3 @@ '<loc>http://ya.ru/page-1/</loc> '+

, xml = '<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -421,3 +433,3 @@ '<loc>https://ya.ru/page-2/</loc> '+

, xml = '<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+

@@ -424,0 +436,0 @@ '<loc>https://ya.ru/page-2/</loc> '+

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