diff --git a/Documentation.md b/Documentation.md index cc4c9c7..f0be113 100644 --- a/Documentation.md +++ b/Documentation.md @@ -149,6 +149,7 @@ name: Option pronouns: Option avatar: Option avatar_caption: Option +avatar_style: Option --- Index content @@ -156,6 +157,7 @@ Index content - If no `name`, the `fullname` used in the configuration will be used - `avatar` is the link of the avatar +- `avatar_style` is either `round` (default) or `square` ## Blog diff --git a/src/misc/markdown.rs b/src/misc/markdown.rs index 7b68b80..51aea8c 100644 --- a/src/misc/markdown.rs +++ b/src/misc/markdown.rs @@ -56,6 +56,7 @@ pub struct FileMetadataIndex { pub pronouns: Option, pub avatar: Option, pub avatar_caption: Option, + pub avatar_style: Option, } /// Metadata for portfolio cards diff --git a/src/routes/index.rs b/src/routes/index.rs index bf9db99..cb23ad1 100644 --- a/src/routes/index.rs +++ b/src/routes/index.rs @@ -24,6 +24,13 @@ struct IndexTemplate { content: Option, avatar: String, avatar_caption: String, + avatar_style: StyleAvatar, +} + +#[derive(Content, Debug, Default)] +struct StyleAvatar { + round: bool, + square: bool, } #[once(time = 60)] @@ -38,6 +45,10 @@ fn build_page(config: Config) -> String { let mut pronouns = None; let mut avatar = "/icons/apple-touch-icon.png".to_owned(); let mut avatar_caption = "EWP avatar".to_owned(); + let mut avatar_style = StyleAvatar { + round: true, + square: false, + }; if let Some(f) = &file { if let Some(m) = &f.metadata.info.index { @@ -45,6 +56,15 @@ fn build_page(config: Config) -> String { avatar = m.avatar.to_owned().unwrap_or(avatar); pronouns = m.pronouns.to_owned(); avatar_caption = m.avatar_caption.to_owned().unwrap_or(avatar_caption); + + if let Some(style) = m.avatar_style.to_owned() { + if style.trim() == "square" { + avatar_style = StyleAvatar { + square: true, + ..StyleAvatar::default() + } + } + } } } else { file = read_file("README.md", TypeFileMetadata::Generic); @@ -62,6 +82,7 @@ fn build_page(config: Config) -> String { pronouns, avatar, avatar_caption, + avatar_style, }, Infos { page_title: config.fc.fullname, diff --git a/static/css/index.css b/static/css/index.css index 6c654d4..40cf831 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -38,7 +38,6 @@ #avatar { width: calc(var(--font-size) * 5); - border-radius: 50%; float: right; } diff --git a/templates/index.html b/templates/index.html index 6c06b7b..2df0219 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,12 +3,23 @@ {{>head.html}} + {{#data}} {{#avatar_style}} {{#round}} + + {{/round}} {{#square}} + + {{/square}} {{/avatar_style}}
{{>navbar.html}}
- {{#data}} -
{{name}} {{#pronouns}}{{pronouns}}{{/pronouns}}