feat: support multi-author blog post
This commit is contained in:
@ -24,8 +24,12 @@ export async function getStaticProps({ params }) {
|
||||
const prev = allPosts[postIndex + 1] || null
|
||||
const next = allPosts[postIndex - 1] || null
|
||||
const post = await getFileBySlug('blog', params.slug)
|
||||
const postAuthor = post.frontMatter.author || 'default'
|
||||
const { frontMatter: authorDetails } = await getFileBySlug('authors', [postAuthor])
|
||||
const authorList = post.frontMatter.authors || ['default']
|
||||
const authorPromise = authorList.map(async (author) => {
|
||||
const authorResults = await getFileBySlug('authors', [author])
|
||||
return authorResults.frontMatter
|
||||
})
|
||||
const authorDetails = await Promise.all(authorPromise)
|
||||
|
||||
// rss
|
||||
const rss = generateRss(allPosts)
|
||||
|
Reference in New Issue
Block a user