Skip to content

Commit

Permalink
Access data files from source folder
Browse files Browse the repository at this point in the history
  • Loading branch information
gemedet committed May 22, 2016
1 parent 569856e commit dd4e474
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/hexo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Hexo.prototype._generate = function(options) {
Locals.prototype.view_dir = pathFn.join(this.theme_dir, 'layout') + sep;

// Run before_generate filters
return this.execFilter('before_generate', null, {context: this})
return this.execFilter('before_generate', self.locals.get('data'), {context: this})
.then(function() {
self.locals.invalidate();
siteLocals = self.locals.toObject();
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/filter/before_generate/render_post.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var Promise = require('bluebird');

function renderPostFilter() {
function renderPostFilter(data) {
var self = this;

function renderPosts(model) {
Expand All @@ -12,6 +12,7 @@ function renderPostFilter() {

return Promise.map(posts, function(post) {
post.content = post._content;
post.site = {data: data};

return self.post.render(post.full_source, post).then(function() {
return post.save();
Expand Down

0 comments on commit dd4e474

Please sign in to comment.