Skip to content

Commit

Permalink
Move posts into year folders
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechu10 committed Sep 17, 2024
1 parent f1f6a43 commit f7de6a1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = true

[dependencies]
console_error_panic_hook = "0.1.7"
include_dir = "0.7.4"
include_dir = { version="0.7.4", features=["glob"] }
mdsycx = { git = "https://github.com/lukechu10/mdsycx", rev = "eb1ac15" }
serde = { version = "1.0.210", features = ["derive"] }
sycamore = "0.9.0-beta.4"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion posts/test.mdx → posts/2024/test.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Test post
date: 2024-09-17
desc: This is a test
desc: Testing various markdown elements.
tags: []
---

Expand Down
6 changes: 4 additions & 2 deletions src/pages/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ static FILES: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/posts");

pub static POSTS: LazyLock<HashMap<String, ParseRes<PostMetadata>>> = LazyLock::new(|| {
FILES
.files()
.map(|file| {
.find("**/*.mdx")
.unwrap()
.map(|dir| {
let file = dir.as_file().unwrap();
let contents = file.contents_utf8().expect("file not utf8");
let mut parse_res: ParseRes<PostMetadata> = mdsycx::parse(contents).expect("parse failed");

Expand Down
8 changes: 5 additions & 3 deletions src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn Route(route: ReadSignal<Routes>) -> View {
view! {
div(class="app flex flex-col min-h-screen text-slate-200 bg-slate-900") {
Header()
main(class="mt-6 flex-grow") {
main(class="mt-6 mx-3 flex-grow") {
(match route.get_clone() {
Routes::Home => view! {
crate::pages::home::Home()
Expand Down Expand Up @@ -65,7 +65,9 @@ fn Footer() -> View {
#[component]
pub fn NotFound() -> View {
view! {
h1 { "404 Not Found" }
p { "The page you are looking for does not exist." }
div(class="max-w-prose mx-auto") {
h1 { "404 Not Found" }
p { "The page you are looking for does not exist." }
}
}
}

0 comments on commit f7de6a1

Please sign in to comment.