Add custom authors to the VuePress.
yarn add vuepress-plugin-custom-authors
Add it to your Vuepress configuration's plugin list:
// .vuepress/config.ts
import { defineUserConfig } from 'vuepress';
import { customAuthorsPlugin } from 'vuepress-plugin-custom-authors';
export default defineUserConfig({
plugins: [
customAuthorsPlugin({
label: 'Your Custom Label', // Custom label text, default: Authors
}),
],
});
Add authors
at the frontmatter of the markdown document:
---
authors: AuthorA, AuthorB
---
Display anywhere in the component:
<script setup lang="ts">
import { computed } from 'vue';
import { usePageData } from '@vuepress/client';
const page = usePageData();
const authors = computed(() => ({
label: page.value.authorLabel,
name: page.value.authors,
}));
</script>
<template>
<p>
<span>{{ authors.label }}: </span>
<span>{{ authors.name }}</span>
</p>
</template>