metalsmith-sitemap
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -23,2 +23,3 @@ /** | ||
* @property {Date} lastmod (optional) | ||
* @property {String} links (optional) | ||
* @property {String} changefreq (optional) | ||
@@ -33,2 +34,4 @@ * @property {Boolean} omitExtension (optional) | ||
* @property {String} modifiedProperty (optional) | ||
* @property {String} privateProperty (optional) | ||
* @property {String} priorityProperty (optional) | ||
* @return {Function} | ||
@@ -56,2 +59,3 @@ */ | ||
var lastmod = opts.lastmod; | ||
var links = opts.links; | ||
var omitExtension = opts.omitExtension; | ||
@@ -64,2 +68,4 @@ var omitIndex = opts.omitIndex; | ||
var modifiedProperty = opts.modifiedProperty || 'lastmod'; | ||
var privateProperty = opts.privateProperty || 'private'; | ||
var priorityProperty = opts.priorityProperty || 'priority'; | ||
@@ -83,3 +89,3 @@ /** | ||
// Don't process private files | ||
if (frontmatter.private) { | ||
if (get(frontmatter, privateProperty)) { | ||
return false; | ||
@@ -125,4 +131,5 @@ } | ||
changefreq: frontmatter.changefreq || changefreq, | ||
priority: frontmatter.priority || priority, | ||
lastmod: get(frontmatter, modifiedProperty) || lastmod | ||
priority: get(frontmatter, priorityProperty) || priority, | ||
lastmod: get(frontmatter, modifiedProperty) || lastmod, | ||
links: get(frontmatter, links) | ||
}, identity); | ||
@@ -129,0 +136,0 @@ |
{ | ||
"name": "metalsmith-sitemap", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A metalsmith plugin for generating a sitemap.xml file.", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "make test" | ||
"test": "mocha test" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
# metalsmith-sitemap | ||
[![npm version][npm-badge]][npm-url] | ||
[![Build Status][travis-badge]][travis-url] | ||
@@ -71,2 +73,8 @@ > A metalsmith plugin for generating a sitemap | ||
##### links | ||
* `optional` | ||
Allows you to define [alternate language pages](https://github.com/ekalinin/sitemap.js#example-of-indicating-alternate-language-pages). This accepts nested properties in dot notation via [lodash.get](https://lodash.com/docs#get). | ||
##### omitExtension | ||
@@ -91,3 +99,3 @@ | ||
Allows you to choose which property to use as the last modified string. This accepts nested properties in dot notation via [loadsh.get](https://lodash.com/docs#get). | ||
Allows you to choose which property to use as the last modified string. This accepts nested properties in dot notation via [lodash.get](https://lodash.com/docs#get). | ||
@@ -99,4 +107,19 @@ ##### urlProperty | ||
Allows you to choose which property to use as the canonical url in the frontmatter. This accepts nested properties in dot notation via [loadsh.get](https://lodash.com/docs#get). | ||
Allows you to choose which property to use as the canonical url in the frontmatter. This accepts nested properties in dot notation via [lodash.get](https://lodash.com/docs#get). | ||
##### privateProperty | ||
* `optional` | ||
* `default: private` | ||
Allows you to choose which property to use for ignoring a file in the frontmatter. This accepts nested properties in dot notation via [lodash.get](https://lodash.com/docs#get). | ||
##### priorityProperty | ||
* `optional` | ||
* `default: priority` | ||
Allows you to choose which property to use for your sitemap priority in the frontmatter. This accepts nested properties in dot notation via [lodash.get](https://lodash.com/docs#get). | ||
## Frontmatter | ||
@@ -128,1 +151,8 @@ | ||
MIT | ||
[npm-badge]: https://img.shields.io/npm/v/metalsmith-sitemap.svg | ||
[npm-url]: https://www.npmjs.com/package/metalsmith-sitemap | ||
[travis-badge]: https://travis-ci.org/ExtraHop/metalsmith-sitemap.svg?branch=master | ||
[travis-url]: https://travis-ci.org/ExtraHop/metalsmith-sitemap |
@@ -36,3 +36,3 @@ var assert = require('assert'); | ||
changefreq: 'never', | ||
priority: '0.0' | ||
priority: 0.1 | ||
})) | ||
@@ -53,3 +53,3 @@ .build(function(err){ | ||
changefreq: 'never', | ||
priority: '0.0', | ||
priority: 0.1, | ||
lastmod: new Date() | ||
@@ -123,3 +123,3 @@ })) | ||
it('should allow a canonical url and lastmod to be set from custom property', function(done){ | ||
it('should allow a canonical url, lastmod and priority to be set from custom property', function(done){ | ||
Metalsmith('test/fixtures/custom-frontmatter') | ||
@@ -129,3 +129,4 @@ .use(sitemap({ | ||
modifiedProperty: 'lastModified', | ||
urlProperty: 'seo.canonical' | ||
urlProperty: 'seo.canonical', | ||
priorityProperty: 'order' | ||
})) | ||
@@ -183,2 +184,17 @@ .build(function(err){ | ||
it('should handle files with links', function(done){ | ||
Metalsmith('test/fixtures/links') | ||
.use(sitemap({ | ||
hostname: 'http://www.website.com/', | ||
links: 'links' | ||
})) | ||
.build(function(err){ | ||
if (err) { | ||
return done(err); | ||
} | ||
equal('test/fixtures/links/expected', 'test/fixtures/links/build'); | ||
done(); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
310
154
22562
56