feat: spruce up design
This commit is contained in:
parent
2614dff452
commit
94e28067f9
51 changed files with 480 additions and 202 deletions
|
@ -68,6 +68,17 @@ export default {
|
|||
return tagMap[url] || ''
|
||||
},
|
||||
|
||||
// posts
|
||||
filterByPostType: (posts, postType) => {
|
||||
if (postType === 'featured') return posts.reverse().filter(post => post.data.featured === true).splice(0, 3)
|
||||
return posts.splice(0, 5)
|
||||
},
|
||||
truncateByWordCount: (text, wordCount) => {
|
||||
const words = sanitizeHtml(text, { allowedTags: ['']}).split(/\s+/);
|
||||
if (words.length > wordCount) return `<p>${words.slice(0, wordCount).join(' ')}...</p>`
|
||||
return text
|
||||
},
|
||||
|
||||
// authors
|
||||
authorLookup: (url) => {
|
||||
if (!url) return null
|
||||
|
|
Reference in a new issue