diff --git a/src/pages/blog_post_list.rs b/src/pages/blog_post_list.rs index faa1232..944dd5b 100644 --- a/src/pages/blog_post_list.rs +++ b/src/pages/blog_post_list.rs @@ -1,6 +1,10 @@ use askama::Template; -use axum::{extract::Path, http::StatusCode}; +use axum::{ + extract::{OriginalUri, Path, RawQuery}, + http::StatusCode, +}; use tokio::try_join; +use tracing::debug; use crate::{ blog_posts::{ @@ -22,10 +26,12 @@ pub struct PostListTemplate { pub header_props: HeaderProps, pub blog_tags: Vec, pub featured_projects: Vec>, + pub current_url: String, } pub async fn render_blog_post_list( tag: Option>, + OriginalUri(original_uri): OriginalUri, ) -> Result { // I will forget what happens here in a week. But essentially it's pattern matching and shadowing let tag = tag.map(|Path(tag)| tag); @@ -63,12 +69,21 @@ pub async fn render_blog_post_list( None => HeaderProps::default(), }; + debug!("uri:{:?}", original_uri); + + let title = if let Some(tag) = &tag { + format!("{tag} blog posts") + } else { + "Blog posts".to_string() + }; + Ok(PostListTemplate { - title: "Blog posts".to_owned(), + title, posts, tag, header_props, blog_tags, featured_projects, + current_url: original_uri.to_string(), }) } diff --git a/src/pages/blog_post_page.rs b/src/pages/blog_post_page.rs index ebf8865..7ceadaa 100644 --- a/src/pages/blog_post_page.rs +++ b/src/pages/blog_post_page.rs @@ -18,6 +18,8 @@ pub struct BlogPostTemplate { pub date: DateTime, pub tags: Vec, pub header_props: HeaderProps, + pub slug: String, + pub thumbnail: Option, } pub async fn render_blog_post(Path(post_id): Path) -> Result { @@ -30,6 +32,8 @@ pub async fn render_blog_post(Path(post_id): Path) -> Result + + + + + + + + + + diff --git a/static/images/creative-commons/cc.svg b/static/images/creative-commons/cc.svg new file mode 100644 index 0000000..cb08896 --- /dev/null +++ b/static/images/creative-commons/cc.svg @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/static/images/creative-commons/nc.svg b/static/images/creative-commons/nc.svg new file mode 100644 index 0000000..fcf2f4b --- /dev/null +++ b/static/images/creative-commons/nc.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/static/images/creative-commons/nd.svg b/static/images/creative-commons/nd.svg new file mode 100644 index 0000000..9ec0da5 --- /dev/null +++ b/static/images/creative-commons/nd.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/templates/base.html b/templates/base.html index 9da1da2..b266134 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,6 +16,13 @@ href="/feed.xml" /> + {% block og_meta %} + + + + + {% endblock %} + diff --git a/templates/blog_post.html b/templates/blog_post.html index 95c5b4c..6b405aa 100644 --- a/templates/blog_post.html +++ b/templates/blog_post.html @@ -1,6 +1,17 @@ {% extends "base.html" %} -{% block title %}{{title}}{% endblock %} +{% block og_meta %} + + + +{% match thumbnail %} +{% when Some with (img) %} + +{% when None %} + +{% endmatch %} + +{% endblock %} {% block content %}
diff --git a/templates/blog_post_list.html b/templates/blog_post_list.html index ff182a9..99e1605 100644 --- a/templates/blog_post_list.html +++ b/templates/blog_post_list.html @@ -1,5 +1,13 @@ {%- import "components/social_card.html" as sc -%} {% extends "base.html" %} + +{% block og_meta %} + + + + +{% endblock %} + {% block content %}
diff --git a/templates/project_list.html b/templates/project_list.html index b491c05..abdd582 100644 --- a/templates/project_list.html +++ b/templates/project_list.html @@ -1,4 +1,12 @@ {% extends "base.html" %} + +{% block og_meta %} + + + + +{% endblock %} + {% block content %}
diff --git a/templates/site_footer.html b/templates/site_footer.html index 14cc057..063ece8 100644 --- a/templates/site_footer.html +++ b/templates/site_footer.html @@ -25,22 +25,22 @@ rel="license noopener noreferrer" style="display: inline-block" >CC BY-NC-ND 4.0ccbync