Permalink
Browse files

Added script to track template popularity

  • Loading branch information...
davidmerfield committed Nov 16, 2018
1 parent 2f4f05f commit 6bcd4579e61935dbf662a60fbc7ae0246e50fab5
Showing with 26 additions and 0 deletions.
  1. +26 −0 scripts/info/template-popularity.js
@@ -0,0 +1,26 @@
var eachBlog = require("../each/blog");
var templates = {};
eachBlog(
function(user, blog, next) {
templates[blog.template] = templates[blog.template] || 0;
templates[blog.template]++;
next();
},
function() {
console.log(
Object.keys(templates)
.map(function(name) {
return { count: templates[name], name: name };
})
.sort(function(a, b) {
return b.count - a.count;
})
.slice(0, 10)
);
process.exit();
}
);

0 comments on commit 6bcd457

Please sign in to comment.