feat: spruce up design

This commit is contained in:
Cory Dransfeldt 2024-04-28 19:06:48 -07:00
parent 2614dff452
commit 94e28067f9
No known key found for this signature in database
51 changed files with 480 additions and 202 deletions

View file

@ -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