diff --git a/justfile b/justfile index 2b99857..e1852cb 100644 --- a/justfile +++ b/justfile @@ -5,18 +5,15 @@ tailwind: npx tailwindcss -i ./styles/input.css -o ./styles/output.css --watch # svg sprite creation -# TODO change route on svetle project deletion -# TODO #directory-swap svgstore: - npx svgstore -o templates/icons/sprite.svg ../src/svg/**.svg + npx svgstore -o templates/icons/sprite.svg src/svg/**.svg server_dev: cargo watch -x run # CMS server for local dev -# TODO #directory-swap decap_server: - cd .. && npx decap-server + npx decap-server # Run dev server in watch mode dev: diff --git a/src/blog_posts/blog_post_model.rs b/src/blog_posts/blog_post_model.rs index 66a64a2..a41021c 100644 --- a/src/blog_posts/blog_post_model.rs +++ b/src/blog_posts/blog_post_model.rs @@ -3,7 +3,7 @@ use serde::Deserialize; use crate::post_utils::post_parser::deserialize_date; -pub const BLOG_POST_PATH: &str = "../_posts/blog"; +pub const BLOG_POST_PATH: &str = "_posts/blog"; #[derive(Deserialize, Debug)] pub struct BlogPostMetadata { diff --git a/src/main.rs b/src/main.rs index 8ca1886..2e37462 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,15 +31,11 @@ async fn main() { // build our application with a single route let app = router::get_router() .nest_service("/styles", ServeDir::new("styles")) - .nest_service("/images", ServeDir::new("../static/images")) - .nest_service("/fonts", ServeDir::new("../static/fonts")) + .nest_service("/images", ServeDir::new("static/images")) + .nest_service("/fonts", ServeDir::new("static/fonts")) .nest_service("/generated_images", ServeDir::new("generated_images")) - .nest_service("/svg", ServeDir::new("../static/svg")) - // TODO manifest logos have bad link, #directory-swap - .nest_service( - "/config.yml", - ServeDir::new("../static/resources/config.yml"), - ); + .nest_service("/svg", ServeDir::new("static/svg")) + .nest_service("/config.yml", ServeDir::new("static/resources/config.yml")); // Decap CMS config #[cfg(debug_assertions)] let app = app.layer(LiveReloadLayer::new()); @@ -59,6 +55,4 @@ async fn main() { // THINK deploy to alula? rather then katelyn? can be change whenever // TODO after release // OG tags -// Remove old web completely -// Restructure repository // - projects page diff --git a/src/pages/blog_post_page.rs b/src/pages/blog_post_page.rs index e7dc5f8..ebf8865 100644 --- a/src/pages/blog_post_page.rs +++ b/src/pages/blog_post_page.rs @@ -2,6 +2,7 @@ use askama::Template; use axum::{extract::Path, http::StatusCode}; use chrono::{DateTime, Utc}; +use crate::blog_posts::blog_post_model::BLOG_POST_PATH; use crate::{ blog_posts::blog_post_model::BlogPostMetadata, components::site_header::Link, filters, post_utils::post_parser::parse_post, @@ -20,7 +21,7 @@ pub struct BlogPostTemplate { } pub async fn render_blog_post(Path(post_id): Path) -> Result { - let path = format!("../_posts/blog/{}.md", post_id); + let path = format!("{}/{}.md", BLOG_POST_PATH, post_id); let parse_post = parse_post::(&path, true); let parsed = parse_post.await?; diff --git a/src/pages/project_list.rs b/src/pages/project_list.rs index 9904ae0..bed9f38 100644 --- a/src/pages/project_list.rs +++ b/src/pages/project_list.rs @@ -16,7 +16,7 @@ pub struct ProjectListTemplate { } pub async fn render_projects_list() -> Result { - let mut project_list = get_post_list::("../_projects").await?; + let mut project_list = get_post_list::("_projects").await?; project_list.sort_by_key(|post| post.slug.to_string()); project_list.retain(|project| project.metadata.displayed); diff --git a/src/picture_generator/picture_markup_generator.rs b/src/picture_generator/picture_markup_generator.rs index 84a4741..7ce8a44 100644 --- a/src/picture_generator/picture_markup_generator.rs +++ b/src/picture_generator/picture_markup_generator.rs @@ -42,9 +42,8 @@ pub fn generate_picture_markup( } let path_to_generated = get_generated_file_name(orig_img_path); - // TODO This should get removed when we move the project structure #directory-swap let disk_img_path = - Path::new("../static/").join(orig_img_path.strip_prefix("/").unwrap_or(orig_img_path)); + Path::new("static/").join(orig_img_path.strip_prefix("/").unwrap_or(orig_img_path)); let orig_img_dimensions = image_dimensions(&disk_img_path)?; let resolutions = get_resolutions(orig_img_dimensions, width, height); diff --git a/src/post_utils/post_listing.rs b/src/post_utils/post_listing.rs index 0aa9c6a..b0369a5 100644 --- a/src/post_utils/post_listing.rs +++ b/src/post_utils/post_listing.rs @@ -8,7 +8,6 @@ use super::post_parser::{parse_post, ParseResult}; pub async fn get_post_list<'de, Metadata: DeserializeOwned>( path: &str, ) -> Result>, StatusCode> { - // let path = "../_posts/blog/"; let mut dir = read_dir(path) .await .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; diff --git a/src/post_utils/post_parser.rs b/src/post_utils/post_parser.rs index b3e3df6..167a9fe 100644 --- a/src/post_utils/post_parser.rs +++ b/src/post_utils/post_parser.rs @@ -117,7 +117,7 @@ pub fn parse_html(markdown: &str, generate_images: bool) -> String { } let dev_only_img_path = - Path::new("../static/").join(dest_url.strip_prefix("/").unwrap_or(&dest_url)); + Path::new("static/").join(dest_url.strip_prefix("/").unwrap_or(&dest_url)); let img_dimensions = image_dimensions(&dev_only_img_path).unwrap(); let (max_width, max_height) = get_max_resolution( diff --git a/src/projects/featured_projects.rs b/src/projects/featured_projects.rs index b0c7c71..bcc156a 100644 --- a/src/projects/featured_projects.rs +++ b/src/projects/featured_projects.rs @@ -5,7 +5,7 @@ use crate::post_utils::{post_listing::get_post_list, post_parser::ParseResult}; use super::project_model::ProjectMetadata; pub async fn get_featured_projects() -> Result>, StatusCode> { - let project_list = get_post_list::("../_projects").await?; + let project_list = get_post_list::("_projects").await?; let featured_projects = project_list .into_iter()