use std::collections::BTreeMap;
use serde::Serialize;
/// Who wrote a post, from the collection's `_authors.yml`, in the post's language.
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct Author {
/// The key the post's frontmatter names.
pub key: String,
/// Their name.
pub name: String,
/// What they do, in the post's language.
pub role: Option<String>,
/// A short biography, in the post's language.
pub bio: Option<String>,
/// A picture.
pub avatar: Option<String>,
/// Name => URL (website, github, linkedin).
pub links: BTreeMap<String, String>,
}
impl Author {
/// An author known by a name alone.
pub fn named(key: impl Into<String>, name: impl Into<String>) -> Self {
Self {
key: key.into(),
name: name.into(),
role: None,
bio: None,
avatar: None,
links: BTreeMap::new(),
}
}
}