Skip to content

Commit

Permalink
Added script to track template popularity
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Nov 16, 2018
1 parent 2f4f05f commit 6bcd457
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/info/template-popularity.js
Original file line number Diff line number Diff line change
@@ -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.