Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export default function WordExpressResolvers(Connectors, publicSettings) {
},
categories(post) {
return Connectors.getPostTerms(post.id)
},
post_excerpt: function post_excerpt(post, { excerpt_length }) {
return post.post_excerpt || post.post_content.split(' ').slice(0, excerpt_length || 55).join(' ')
}
},
Postmeta: {
Expand Down
2 changes: 1 addition & 1 deletion src/schema/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Post = `
id: Int
post_title: String
post_content: String
post_excerpt: String
post_excerpt(excerpt_length: Int): String
post_status: String
post_type: String
post_name: String
Expand Down