<commit_before>var ejs = require('ejs'),
  _ = require('lodash'),
  path = require('path'),
  file = hexo.util.file2;

var sitemapSrc = path.join(__dirname, 'sitemap.ejs'),
  sitemapTmpl = ejs.compile(file.readFileSync(sitemapSrc));

hexo.extend.generator.register(function(locals, render, callback){
  var config = hexo.config;

  var sitemapConfig = _.extend({
    path: 'sitemap.xml'
  }, config.sitemap);

  if (!path.extname(sitemapConfig.path)){
    sitemapConfig.path += '.xml';
  }

  var posts = [].concat(locals.posts.toArray(), locals.pages.toArray()).sort(function(a, b){
    return b.updated - a.updated;
  });

  var xml = sitemapTmpl({
    config: config,
    posts: posts
  });

  hexo.route.set(sitemapConfig.path, xml);
  callback();
});<commit_msg>Filter posts/pages whose sitemap attribute is false<commit_after>var ejs = require('ejs'),
  _ = require('lodash'),
  path = require('path'),
  file = hexo.util.file2;

var sitemapSrc = path.join(__dirname, 'sitemap.ejs'),
  sitemapTmpl = ejs.compile(file.readFileSync(sitemapSrc));

hexo.extend.generator.register(function(locals, render, callback){
  var config = hexo.config;

  var sitemapConfig = _.extend({
    path: 'sitemap.xml'
  }, config.sitemap);

  if (!path.extname(sitemapConfig.path)){
    sitemapConfig.path += '.xml';
  }

  var posts = [].concat(locals.posts.toArray(), locals.pages.toArray())
    .filter(function(item){
      return item.sitemap !== false;
    })
    .sort(function(a, b){
      return b.updated - a.updated;
    });

  var xml = sitemapTmpl({
    config: config,
    posts: posts
  });

  hexo.route.set(sitemapConfig.path, xml);
  callback();
});
{'fraction_non_alphanumeric': 0.16878402903811252, 'fraction_numerical': 0.0012099213551119178, 'mean_word_length': 3.8504398826979473, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2024932', 'n_tokens_mistral': 611, 'n_tokens_neox': 594, 'n_words': 107}