Add support for multiple authors
Opened this issue · 2 comments
We have 2 writers on our blog, and all posts appears to be made by me. Is there any way or possibility to add support for multiple authors?
For example, in .md header:
author: author1
+1
We have 2 writers on our blog, and all posts appears to be made by me. Is there any way or possibility to add support for multiple authors?
For example, in .md header:
author: author1
I achieved the multi-autor doing the following:
Go to the theme's config file and create two new author profile entrys. You can add each authors info on each profile:
profile1:
author: Author 1 Name
image: /images/avatar1.jpg
link: /about
description:
social:
github:
facebook:
linkedin:
instagram:
twitter:
rss: /atom.xml
profile2:
author: Author 2 Name
image: /images/avatar2.jpg
link: /about
description:
social:
github:
facebook:
linkedin:
instagram:
twitter:
rss: /atom.xml
Then go to the \themes\overdose\layout\includes\article.pug
Delete this:
- var profileImageSrc = theme.profile.image || gravatar(theme.profile.gravatar || '');
.article__author(
itemscope
itemprop="author"
itemtype="https://schema.org/Person")
img.article__author__image(
src=profileImageSrc
alt=config.author)
a.article__author__link(
href=theme.profile.link
title=About ${config.author}
rel="author"
)= config.author
p.article__author__desc= theme.profile.description || config.description
.article__author__socials
each url, label in theme.profile.social
if url
a.article__author__socials__item(
href=url
title=label
target="_blank")
i(class=fa fa-${label}
)
meta(itemprop="name" content=config.author)
And add this:
if page.author && page.author === 'profile1'
.article__author(
itemscope
itemprop="author"
itemtype="https://schema.org/Person")
img.article__author__image(
src=theme.profile1.image
alt=theme.profile1.author)
a.article__author__link(
href=theme.profile.link
title=About ${theme.profile1.author}
rel="author"
)= theme.profile1.author
p.article__author__desc= theme.profile1.description
.article__author__socials
each url, label in theme.profile1.social
if url
a.article__author__socials__item(
href=url
title=label
target="_blank")
i(class=fa fa-${label}
)
meta(itemprop="name" content=theme.profile1.author)
else if page.author && page.author === 'profile2'
.article__author(
itemscope
itemprop="author"
itemtype="https://schema.org/Person")
img.article__author__image(
src=theme.profile2.image
alt=theme.profile2.author)
a.article__author__link(
href=theme.profile_2.link
title=About ${theme.profile2.author}
rel="author"
)= theme.profile2.author
p.article__author__desc= theme.profile2.description
.article__author__socials
each url, label in theme.profile2.social
if url
a.article__author__socials__item(
href=url
title=label
target="_blank")
i(class=fa fa-${label}
)
meta(itemprop="name" content=theme.profile2.author)
Now you only need to add the following entry on each post or page where you want to add a writters profile:
author: profile1
or
author: profile2
If you don't add any author it will be empty.
You can also add more authors with the same logic.
If you wanna see it working, my blog is under this configuration now (with two authors):
https://firstcommit.dev/