diff --git a/_posts/blog/dev-2019-08-09-ide-to.md b/_posts/blog/dev-2019-08-09-ide-to.md index 3b9c164..fae2dc6 100644 --- a/_posts/blog/dev-2019-08-09-ide-to.md +++ b/_posts/blog/dev-2019-08-09-ide-to.md @@ -7,7 +7,7 @@ segments: - cookbook published: true date: 2019-08-09T17:24:13.481Z -thumbnail: /images/uploads/screenshot.gif +#thumbnail: /images/uploads/screenshot.gif tags: - dev --- diff --git a/axum_server/src/filters.rs b/axum_server/src/filters.rs index 4b83b3a..b68dabb 100644 --- a/axum_server/src/filters.rs +++ b/axum_server/src/filters.rs @@ -8,10 +8,10 @@ pub fn pretty_date(date_time: &DateTime) -> ::askama::Result { } // This filter does not have extra arguments -pub fn description_filter(body: &String) -> ::askama::Result { +pub fn description_filter(body: &str) -> ::askama::Result { let description = body .lines() - .filter(|line| line.starts_with("")) .take(2) .collect::>() .join("\n"); diff --git a/axum_server/src/main.rs b/axum_server/src/main.rs index 06cc051..6b132ca 100644 --- a/axum_server/src/main.rs +++ b/axum_server/src/main.rs @@ -49,5 +49,7 @@ async fn main() { } // TODO responsive design +// - contact +// TODO Fix header menu link on blog // TODO Colors // TODO go live pipeline diff --git a/axum_server/src/pages/blog_post_list.rs b/axum_server/src/pages/blog_post_list.rs index 4869147..b4c5676 100644 --- a/axum_server/src/pages/blog_post_list.rs +++ b/axum_server/src/pages/blog_post_list.rs @@ -1,20 +1,27 @@ use askama::Template; use axum::{extract::Path, http::StatusCode}; +use tokio::try_join; use crate::{ - blog_posts::blog_post_model::{BlogPostMetadata, BLOG_POST_PATH}, + blog_posts::{ + blog_post_model::{BlogPostMetadata, BLOG_POST_PATH}, + tag_list::get_popular_blog_tags, + }, components::site_header::{HeaderProps, Link}, filters, post_utils::{post_listing::get_post_list, post_parser::ParseResult}, + projects::{featured_projects::get_featured_projects, project_model::ProjectMetadata}, }; #[derive(Template)] -#[template(path = "post_list.html")] +#[template(path = "blog_post_list.html")] pub struct PostListTemplate { pub title: String, pub posts: Vec>, pub tag: Option, pub header_props: HeaderProps, + pub blog_tags: Vec, + pub featured_projects: Vec>, } pub async fn render_blog_post_list( @@ -23,7 +30,12 @@ pub async fn render_blog_post_list( // I will forget what happens here in a week. But essentially it's pattern matching and shadowing let tag = tag.map(|Path(tag)| tag); - let mut post_list = get_post_list::(BLOG_POST_PATH).await?; + let (blog_tags, featured_projects, mut post_list) = try_join!( + get_popular_blog_tags(), + get_featured_projects(), + get_post_list::(BLOG_POST_PATH) + )?; + post_list.sort_by_key(|post| post.metadata.date); post_list.retain(|post| post.metadata.published); post_list.reverse(); @@ -56,5 +68,7 @@ pub async fn render_blog_post_list( posts, tag, header_props, + blog_tags, + featured_projects, }) } diff --git a/axum_server/src/picture_generator/picture_markup_generator.rs b/axum_server/src/picture_generator/picture_markup_generator.rs index 783c214..4395b51 100644 --- a/axum_server/src/picture_generator/picture_markup_generator.rs +++ b/axum_server/src/picture_generator/picture_markup_generator.rs @@ -27,7 +27,7 @@ pub fn generate_picture_markup( let dev_only_img_path = Path::new("../static/").join(orig_img_path.strip_prefix("/").unwrap_or(orig_img_path)); - let orig_img_dimensions = image_dimensions(&dev_only_img_path).unwrap(); + let orig_img_dimensions = image_dimensions(&dev_only_img_path)?; let resolutions = get_resolutions(orig_img_dimensions, width, height); let path_to_generated_arc = Arc::new(path_to_generated); diff --git a/axum_server/src/post_utils/post_parser.rs b/axum_server/src/post_utils/post_parser.rs index 9db7f6c..b7fd6b9 100644 --- a/axum_server/src/post_utils/post_parser.rs +++ b/axum_server/src/post_utils/post_parser.rs @@ -163,9 +163,6 @@ pub fn parse_html(markdown: &str, generate_images: bool) -> String { let syntax_reference = syntax_set .find_syntax_by_token(lang) .unwrap_or(syntax_set.find_syntax_plain_text()); - syntax_set.syntaxes().iter().for_each(|sr| { - debug!("{}", sr.name); - }); let highlighted = highlighted_html_for_string(&text, &syntax_set, syntax_reference, theme) .unwrap(); diff --git a/axum_server/styles/output.css b/axum_server/styles/output.css index 538f479..bbc9b3c 100644 --- a/axum_server/styles/output.css +++ b/axum_server/styles/output.css @@ -633,11 +633,6 @@ video { margin-bottom: 1.5rem; } -.my-auto { - margin-top: auto; - margin-bottom: auto; -} - .mb-1 { margin-bottom: 0.25rem; } @@ -750,6 +745,14 @@ video { grid-template-columns: max-content 1fr; } +.grid-rows-\[max-content_max-content_max-content\] { + grid-template-rows: max-content max-content max-content; +} + +.grid-rows-\[max-content_1fr_max-content\] { + grid-template-rows: max-content 1fr max-content; +} + .flex-row { flex-direction: row; } @@ -786,24 +789,6 @@ video { gap: 1rem; } -.gap-8 { - gap: 2rem; -} - -.gap-x-64 { - -moz-column-gap: 16rem; - column-gap: 16rem; -} - -.gap-y-8 { - row-gap: 2rem; -} - -.gap-x-32 { - -moz-column-gap: 8rem; - column-gap: 8rem; -} - .overflow-hidden { overflow: hidden; } @@ -915,6 +900,10 @@ video { text-align: right; } +.text-justify { + text-align: justify; +} + .text-2xl { font-size: 1.5rem; line-height: 2rem; @@ -1492,6 +1481,11 @@ a { } @media (min-width: 768px) { + .md\:my-8 { + margin-top: 2rem; + margin-bottom: 2rem; + } + .md\:grid { display: grid; } @@ -1516,6 +1510,15 @@ a { justify-content: stretch; } + .md\:gap-8 { + gap: 2rem; + } + + .md\:gap-x-8 { + -moz-column-gap: 2rem; + column-gap: 2rem; + } + .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; @@ -1545,6 +1548,16 @@ a { font-size: 1.25rem; line-height: 1.75rem; } + + .md\:text-5xl { + font-size: 3rem; + line-height: 1; + } + + .md\:text-6xl { + font-size: 3.75rem; + line-height: 1; + } } @media (min-width: 1024px) { @@ -1552,6 +1565,10 @@ a { grid-column: span 2 / span 2; } + .lg\:row-span-2 { + grid-row: span 2 / span 2; + } + .lg\:row-start-2 { grid-row-start: 2; } @@ -1560,6 +1577,10 @@ a { margin-top: 5rem; } + .lg\:block { + display: block; + } + .lg\:grid { display: grid; } @@ -1572,6 +1593,18 @@ a { grid-template-columns: repeat(2, minmax(0, 1fr)); } + .lg\:grid-cols-\[1fr_2fr\] { + grid-template-columns: 1fr 2fr; + } + + .lg\:grid-cols-\[2fr_1fr\] { + grid-template-columns: 2fr 1fr; + } + + .lg\:grid-rows-\[min-content_1fr\] { + grid-template-rows: min-content 1fr; + } + .lg\:gap-x-32 { -moz-column-gap: 8rem; column-gap: 8rem; @@ -1585,6 +1618,11 @@ a { font-size: 3.75rem; line-height: 1; } + + .lg\:text-lg { + font-size: 1.125rem; + line-height: 1.75rem; + } } @media (min-width: 1280px) { diff --git a/axum_server/templates/blog_post_list.html b/axum_server/templates/blog_post_list.html new file mode 100644 index 0000000..1a2e396 --- /dev/null +++ b/axum_server/templates/blog_post_list.html @@ -0,0 +1,56 @@ +{%- import "components/social_card.html" as sc -%} +{% extends "base.html" %} +{% block content %} + +
+
+ {% if posts.len() == 0 %} +

You've found void in the space.

+ {% else %} +

+ {% if let Some(t) = tag %} + {{t}} + {% else %} + Blog posts + {% endif %} +

+ +
+ +
+ +
+ +
    + {% for post in posts %} +
  • + {% include "components/blog_post_preview.html" %} +
    +
  • + {% endfor %} +
+ {% endif %} +
+ + + +
+{% endblock %} diff --git a/axum_server/templates/components/blog_post_preview.html b/axum_server/templates/components/blog_post_preview.html index 9a4e11a..396b71c 100644 --- a/axum_server/templates/components/blog_post_preview.html +++ b/axum_server/templates/components/blog_post_preview.html @@ -1,17 +1,19 @@ -
+
-

{{post.metadata.title}}

+

+ {{post.metadata.title}} +

-
{{post.body|description_filter|safe}}
-