Skip to content

Instantly share code, notes, and snippets.

@jorgt
Created March 26, 2015 01:58
Show Gist options
  • Save jorgt/238119f5e8d5c14be0d8 to your computer and use it in GitHub Desktop.
Save jorgt/238119f5e8d5c14be0d8 to your computer and use it in GitHub Desktop.
hexo 3.0.0 node_modules/hexo/lib/plugins\filter/after_post_render/excerpt.js fix
'use strict';
var rExcerpt = /<!-{2,} *more *-{2,}>/;
function excerptFilter(data){
var content = data.content;
var match = content.match(/(<![- ]{2,}more[- ]{2,}>[\s\S+](.*)[\s\S+]<![- ]{2,}more[- ]{2,}><\/.+>)/mi);
if(match) {
data.excerpt = match[0].replace(/<!-{2,} *more *-{2,}>/gi,'');
data.more = data.content = content.replace(match[0], '<a id="more"></a>');
} else {
data.excerpt = '';
data.more = content;
}
}
module.exports = excerptFilter;
@jorgt
Copy link
Author

jorgt commented Mar 26, 2015

hexo 3.0.0 broke the excerpts. This fix works for my own theme and it's intended as a temporary thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment