diff --git a/src/.vuepress/config/authors.js b/src/.vuepress/config/authors.js index 2362a92d..d8f02283 100644 --- a/src/.vuepress/config/authors.js +++ b/src/.vuepress/config/authors.js @@ -34,4 +34,49 @@ module.exports = new Map([ twitter: '@jesseclayburgh', }, ], + [ + 'jenn-turner', + { + name: 'Jenn Turner', + avatar: 'jenn-turner.jpg', + twitter: '@jennwrites', + }, + ], + [ + 'dietrich-ayala', + { + name: 'Dietrich Ayala', + avatar: 'dietrich-ayala.jpg', + twitter: '@dietrich', + }, + ], + [ + 'david-dias', + { + name: 'David Dias', + avatar: 'david-dias.jpg', + twitter: '@daviddias', + }, + ], + [ + 'whyrusleeping', + { + name: 'whyrusleeping', + avatar: 'whyrusleeping.jpg', + }, + ], + [ + 'lidel', + { + name: 'lidel', + avatar: 'lidel.jpg', + }, + ], + [ + 'alan-shaw', + { + name: 'Alan Shaw', + avatar: 'alan-shaw.jpg', + }, + ], ]) diff --git a/src/.vuepress/plugins/pageData.js b/src/.vuepress/plugins/pageData.js index 170aa2f6..d98c7634 100644 --- a/src/.vuepress/plugins/pageData.js +++ b/src/.vuepress/plugins/pageData.js @@ -1,17 +1,36 @@ +const { chalk } = require('@vuepress/shared-utils') const slug = require('slug') module.exports = (options, context) => ({ extendPageData($page) { - const { frontmatter } = $page + const { frontmatter, _filePath } = $page + const { authors } = options // author config const authorName = frontmatter.author + const authorAvatarUrl = frontmatter.avatarUrl + if (typeof authorName === 'string') { const authorKey = slug(authorName, { lower: true }) // setup author stub to keep templates happy - const author = { name: authorName } + let author = { name: authorName } + if (authors.has(authorKey)) { + author = authors.get(authorKey) + } else if (authorAvatarUrl) { + author.avatarUrl = authorAvatarUrl + } else { + console.error( + `${chalk.red( + 'error' + )} Could not find a configured author for ${chalk.cyan( + authorName + )} used in ${_filePath}. You need to add a new key in ${chalk.cyan( + '.vuepress/config/authors.js' + )} or set a frontmatter value for ${chalk.cyan('avatarUrl')}` + ) + } // setup the page author object frontmatter.author = author frontmatter.authorKey = authorKey diff --git a/src/.vuepress/theme/components/base/Avatar.vue b/src/.vuepress/theme/components/base/Avatar.vue index 6b8a37d0..f05d2d18 100644 --- a/src/.vuepress/theme/components/base/Avatar.vue +++ b/src/.vuepress/theme/components/base/Avatar.vue @@ -15,6 +15,12 @@ ctx="_assets/avatars/" :alt="name" /> + diff --git a/src/.vuepress/theme/components/blog/ActiveTags.vue b/src/.vuepress/theme/components/blog/ActiveTags.vue index 548953db..652374e6 100644 --- a/src/.vuepress/theme/components/blog/ActiveTags.vue +++ b/src/.vuepress/theme/components/blog/ActiveTags.vue @@ -12,14 +12,13 @@ > (newest first) of {{ activeCategory }} - for " + for {{ text }} + >"{{ text }}" - " with tag{{ numberOfPosts > 1 ? 's' : '' }}:with tag{{ activeTags.length > 1 ? 's' : '' }}: