Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(filter): use existing excerpt if possible #3612

Merged
merged 2 commits into from Jul 27, 2019
Merged

feat(filter): use existing excerpt if possible #3612

merged 2 commits into from Jul 27, 2019

Conversation

ppoffice
Copy link
Contributor

@ppoffice ppoffice commented Jul 4, 2019

What does it do?

Skip excerpt generation for posts or pages if it is set in the front matter. This gives users the ability to write down whatever abstract they want instead of just showing begining part of the post.

For example:

title: An article about blah blah blah
excerpt: This article is all about blah blah blah blah blah blah
---
Actual markdown content...

will generate:

{
    excerpt: 'This article is all about blah blah blah blah blah blah',
    more: 'Actual markdown content...',
    content: 'Actual markdown content...'
}

How to test

git clone -b BRANCH https://github.com/ppoffice/hexo.git
cd hexo
npm install
npm test

Screenshots

N/A

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@coveralls
Copy link

@coveralls coveralls commented Jul 4, 2019

Coverage Status

Coverage increased (+0.002%) to 97.15% when pulling c321663 on ppoffice:master into f2ddc99 on hexojs:master.

@coveralls
Copy link

@coveralls coveralls commented Jul 4, 2019

Coverage Status

Coverage increased (+0.002%) to 97.15% when pulling d819f18 on ppoffice:master into f2ddc99 on hexojs:master.

@curbengh
Copy link
Contributor

@curbengh curbengh commented Jul 9, 2019

I prefer this approach (using it myself) than <!--more-->, looks cleaner. <!--more--> does have the advantage of supporting formatting though.

test/scripts/filters/excerpt.js Outdated Show resolved Hide resolved
@yoshinorin yoshinorin added this to the v4.0.0 milestone Jul 10, 2019
@yoshinorin yoshinorin merged commit 4931608 into hexojs:master Jul 27, 2019
4 checks passed
curbengh pushed a commit to curbengh/curbengh.github.io that referenced this issue Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants