diff --git a/src/.vuepress/theme/components/blog/PostAuthor.vue b/src/.vuepress/theme/components/blog/PostAuthor.vue index 98ab1057..ab023488 100644 --- a/src/.vuepress/theme/components/blog/PostAuthor.vue +++ b/src/.vuepress/theme/components/blog/PostAuthor.vue @@ -7,11 +7,17 @@ class="flex items-center" > {{ name }} + >{{ index === 0 ? '' : ',' }} + + {{ piece }} + + @@ -25,11 +31,20 @@ export default { mixins: [Author], computed: { ...mapState('appState', ['activeAuthor']), + resolvedAuthorName() { + const pieces = this.name.match(/[,&]/g) + + if (!pieces) { + return [this.name] + } + + return this.name.split(/[,&]/g) + }, }, methods: { - handleAuthorClick() { - if (!this.activeAuthor !== this.name) { - this.$store.commit('appState/setActiveAuthor', this.name) + handleAuthorClick(piece) { + if (!this.activeAuthor !== piece) { + this.$store.commit('appState/setActiveAuthor', piece) } }, }, diff --git a/src/.vuepress/theme/util/blogUtils.js b/src/.vuepress/theme/util/blogUtils.js index d4a8f34f..16e039aa 100644 --- a/src/.vuepress/theme/util/blogUtils.js +++ b/src/.vuepress/theme/util/blogUtils.js @@ -12,7 +12,11 @@ export const checkItem = ({ return false } - if (activeAuthor && decodeURI(activeAuthor) !== author.name) { + if ( + activeAuthor && + ((author.name && !author.name.includes(decodeURI(activeAuthor))) || + !author.name) + ) { return false }