Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit cd6ec6a

Browse files
made exceprts more sexy
1 parent 28afc61 commit cd6ec6a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

server/hooks/create-excerpt.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const sanitizeOptions = {
1212
allowedAttributes: {
1313
a: ['href', 'class', 'target', 'data-*' , 'contenteditable'],
1414
span: ['contenteditable', 'class', 'data-*']
15-
},
15+
}
1616
};
1717

1818
module.exports = function (options = {}) { // eslint-disable-line no-unused-vars
@@ -35,17 +35,14 @@ module.exports = function (options = {}) { // eslint-disable-line no-unused-vars
3535

3636
contentBefore = trunc(content, 9999999999);
3737
const contentTruncated = trunc(contentSanitized, options.length);
38-
hook.app.debug('contentBefore');
39-
hook.app.debug(contentBefore.text.length);
40-
hook.app.debug('contentTruncated');
41-
hook.app.debug(contentTruncated.text.length);
4238

4339
const hasMore = contentBefore.text.length > (contentTruncated.text.length + 20);
4440
setByDot(hook.data, 'hasMore', hasMore);
4541

4642
// set excerpt
4743
setByDot(hook.data, `${options.field}Excerpt`, hasMore ? contentTruncated.html : content.replace(/(\ ){2,}/ig, ' '))
4844
} catch (err) {
45+
hook.app.error(err);
4946
throw new Error(err);
5047
}
5148
// trim content

0 commit comments

Comments
 (0)