rounded square pfp #55
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
This commit is contained in:
parent
6f8103ac97
commit
116bc311c8
5 changed files with 37 additions and 3 deletions
|
@ -149,6 +149,7 @@ name: Option<String>
|
|||
pronouns: Option<String>
|
||||
avatar: Option<String>
|
||||
avatar_caption: Option<String>
|
||||
avatar_style: Option<String>
|
||||
---
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ pub struct FileMetadataIndex {
|
|||
pub pronouns: Option<String>,
|
||||
pub avatar: Option<String>,
|
||||
pub avatar_caption: Option<String>,
|
||||
pub avatar_style: Option<String>,
|
||||
}
|
||||
|
||||
/// Metadata for portfolio cards
|
||||
|
|
|
@ -24,6 +24,13 @@ struct IndexTemplate {
|
|||
content: Option<File>,
|
||||
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,
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#avatar {
|
||||
width: calc(var(--font-size) * 5);
|
||||
border-radius: 50%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,23 @@
|
|||
<head dir="ltr">
|
||||
{{>head.html}}
|
||||
<link rel="stylesheet" href="/css/index.css" />
|
||||
{{#data}} {{#avatar_style}} {{#round}}
|
||||
<style>
|
||||
#avatar {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
{{/round}} {{#square}}
|
||||
<style>
|
||||
#avatar {
|
||||
border-radius: 10%;
|
||||
}
|
||||
</style>
|
||||
{{/square}} {{/avatar_style}}
|
||||
</head>
|
||||
<body>
|
||||
<header>{{>navbar.html}}</header>
|
||||
<main>
|
||||
{{#data}}
|
||||
|
||||
<div>
|
||||
<span id="name">{{name}}</span>
|
||||
{{#pronouns}}<span id="pronouns">{{pronouns}}</span>{{/pronouns}}
|
||||
|
|
Loading…
Reference in a new issue