forked from slonk/bingus-blog
better post icon and color support
This commit is contained in:
parent
602f57581a
commit
342a353b36
4 changed files with 16 additions and 0 deletions
|
@ -14,6 +14,7 @@ blazingly fast markdown blog software written in rust memory safe
|
|||
- [x] RSS
|
||||
- [x] finish writing this document
|
||||
- [x] document config
|
||||
- [ ] alt text for post icon
|
||||
- [ ] extend syntect options
|
||||
- [ ] general cleanup of code
|
||||
- [ ] better error reporting and error pages
|
||||
|
|
|
@ -27,6 +27,7 @@ struct FrontMatter {
|
|||
pub description: String,
|
||||
pub author: String,
|
||||
pub icon: Option<String>,
|
||||
pub color: Option<String>,
|
||||
pub created_at: Option<DateTime<Utc>>,
|
||||
pub modified_at: Option<DateTime<Utc>>,
|
||||
#[serde(default)]
|
||||
|
@ -46,6 +47,7 @@ impl FrontMatter {
|
|||
description: self.description,
|
||||
author: self.author,
|
||||
icon: self.icon,
|
||||
color: self.color,
|
||||
created_at: self.created_at.or_else(|| created.map(|t| t.into())),
|
||||
modified_at: self.modified_at.or_else(|| modified.map(|t| t.into())),
|
||||
tags: self.tags.into_iter().collect(),
|
||||
|
|
|
@ -17,6 +17,8 @@ pub struct PostMetadata {
|
|||
pub description: String,
|
||||
pub author: String,
|
||||
pub icon: Option<String>,
|
||||
//pub icon_alt: Option<String>,
|
||||
pub color: Option<String>,
|
||||
pub created_at: Option<DateTime<Utc>>,
|
||||
pub modified_at: Option<DateTime<Utc>>,
|
||||
pub tags: Vec<String>,
|
||||
|
|
|
@ -7,10 +7,21 @@
|
|||
<meta name="author" content="{{ meta.author }}" />
|
||||
<meta name="keywords" content="{{ meta.tags|join(", ") }}" />
|
||||
<meta name="description" content="{{ meta.title }}" />
|
||||
<!-- you know what I really love? platforms like discord
|
||||
favoring twitter embeds over the open standard. to color
|
||||
your embed or have large images, you have to do _this_. lmao -->
|
||||
<meta property="og:title" content="{{ meta.title }}" />
|
||||
<meta property="twitter:title" content="{{ meta.title }}" />
|
||||
<meta property="og:description" content="{{ meta.description }}" />
|
||||
<meta property="twitter:description" content="{{ meta.description }}" />
|
||||
{% match meta.icon %} {% when Some with (url) %}
|
||||
<meta property="og:image" content="{{ url }}" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:image:src" content="{{ url }}" />
|
||||
{% when None %} {% endmatch %}
|
||||
<!-- prettier is annoying -->
|
||||
{% match meta.color %} {% when Some with (color) %}
|
||||
<meta name="theme-color" content="{{ color }}" />
|
||||
{% when None %} {% endmatch %}
|
||||
<title>{{ meta.title }}</title>
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
|
|
Loading…
Reference in a new issue