Created
March 26, 2015 01:58
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hexo 3.0.0 broke the excerpts. This fix works for my own theme and it's intended as a temporary thing.