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

hexo-generator-better-sitemap

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-generator-better-sitemap - npm Package Compare versions

Comparing version 0.2.2 to 1.0.0-rc.1

16

lib/category.js

@@ -1,2 +0,1 @@

const _ = require('lodash');
const common = require('./common');

@@ -15,12 +14,13 @@

const categories = _(locals.categories.toArray())
const sortBy = (key) => {
return (a, b) => (a[key] > b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
};
const categories = locals.categories.toArray()
.filter(mentionedInPosts)
.map(common.setItemLastUpdate)
.sortBy('updated').reverse()
.value();
.sort(sortBy('updated'))
.reverse();
const lastUpdatedCategory = _.chain(categories)
.first()
.get('updated')
.value();
const lastUpdatedCategory = [].concat(categories).shift()?.updated;

@@ -27,0 +27,0 @@ return {

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

const _ = require('lodash');
const Promise = require('bluebird');
const fs = Promise.promisifyAll(require('fs'));
const getPostUpdated = ({updated}) => updated.toDate();
const getPostUpdated = ({ updated }) => updated.toDate();

@@ -10,10 +9,10 @@ const common = {

const posts = item.posts.toArray();
item.updated = _.maxBy(posts, getPostUpdated).updated.toDate();
item.updated = posts.reduce((a, b) => { return getPostUpdated(a) >= getPostUpdated(b) ? a : b }, {}).updated.toDate()
return item;
},
getFileContent(filePath) {
return fs.readFileAsync(filePath, {encoding: 'utf8'});
return fs.readFileAsync(filePath, { encoding: 'utf8' });
},
isDefined: _.negate(_.isUndefined),
getIndexSitemapFilename({sitemap, root}) {
getIndexSitemapFilename({ sitemap, root }) {
if (sitemap && sitemap.path) {

@@ -20,0 +19,0 @@ return sitemap.path;

const Promise = require('bluebird');
const common = require('./common');

@@ -23,3 +22,3 @@ const seoFriendlySitemap = function (locals) {

return Promise.all(sitemaps)
.filter(common.isDefined)
.filter(Boolean)
.then(indexSitemap.get)

@@ -26,0 +25,0 @@ .map(render);

@@ -1,2 +0,1 @@

const _ = require('lodash');
const common = require('./common');

@@ -7,6 +6,5 @@ const urljoin = require('url-join');

const get = filePaths => {
const indexSitemapItems = _.chain(filePaths)
.filter('isInIndexSitemap')
const indexSitemapItems = filePaths
.filter(v => v.isInIndexSitemap)
.map(getIndexSitemapItem)
.value();

@@ -13,0 +11,0 @@ filePaths.push({

@@ -1,3 +0,11 @@

const _ = require('lodash');
const reject = (arr, predicate) => {
const complement = (f) => (x) => !f(x);
return arr.filter(complement(predicate));
};
const sortBy = (key) => {
return (a, b) => (a[key] < b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
};
const page = (locals, config) => {

@@ -19,11 +27,7 @@

}
const pages = _(locals.pages.toArray())
.reject(isExcluded)
.orderBy('updated', 'desc')
.value();
const pages = reject(locals.pages.toArray(), isExcluded)
.concat()
.sort(sortBy('updated'));
const lastUpdatedPage = _.chain(pages)
.first()
.get('updated')
.value();
const lastUpdatedPage = [].concat(pages).shift()?.updated;

@@ -41,7 +45,5 @@ return {

return {
get
};
return { get };
};
module.exports = page;

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

const _ = require('lodash');
const urljoin = require('url-join');
const postInSitemap = ({sitemap, published}) => sitemap !== false && published;
const sortBy = (key) => {
return (a, b) => (a[key] < b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
};
const postInSitemap = ({ sitemap, published }) => sitemap !== false && published;
const post = locals => {

@@ -11,11 +14,8 @@ const get = () => {

}
const posts = _(locals.posts.toArray())
const posts = locals.posts.toArray()
.filter(postInSitemap)
.orderBy('updated', 'desc')
.value();
.concat()
.sort(sortBy('updated'));
const lastUpdatedPost = _.chain(posts)
.first()
.get('updated')
.value();
const lastUpdatedPost = [].concat(posts).shift()?.updated;

@@ -22,0 +22,0 @@ return {

@@ -1,4 +0,7 @@

const _ = require('lodash');
const common = require('./common');
const sortBy = (key) => {
return (a, b) => (a[key] < b[key]) ? 1 : ((b[key] > a[key]) ? -1 : 0);
};
const mentionedInPosts = ({posts}) => posts.length > 0;

@@ -15,12 +18,9 @@

const tags = _(locals.tags.toArray())
const tags = locals.tags.toArray()
.filter(mentionedInPosts)
.map(common.setItemLastUpdate)
.sortBy('updated').reverse()
.value();
.sort(sortBy('updated'))
.reverse();
const lastUpdatedTag = _.chain(tags)
.first()
.get('updated')
.value();
const lastUpdatedTag = [].concat(tags).shift()?.updated;

@@ -27,0 +27,0 @@ return {

{
"name": "hexo-generator-better-sitemap",
"description": "SEO-friendly sitemap generator plugin for Hexo",
"version": "0.2.2",
"version": "1.0.0-rc.1",
"author": {

@@ -6,0 +6,0 @@ "name": "SukkaW",

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