Compare commits
2 commits
bb17ea5f2e
...
dcdec71f4c
Author | SHA1 | Date | |
---|---|---|---|
dcdec71f4c | |||
8289137d3d |
18 changed files with 879 additions and 76 deletions
260
Cargo.lock
generated
260
Cargo.lock
generated
|
@ -260,6 +260,8 @@ dependencies = [
|
|||
"askama",
|
||||
"askama_axum",
|
||||
"axum",
|
||||
"markdown",
|
||||
"notify",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-http",
|
||||
|
@ -292,12 +294,39 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"libredox",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.28"
|
||||
|
@ -323,6 +352,15 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.30"
|
||||
|
@ -519,6 +557,26 @@ dependencies = [
|
|||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"inotify-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify-sys"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iri-string"
|
||||
version = "0.7.0"
|
||||
|
@ -544,6 +602,26 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c"
|
||||
dependencies = [
|
||||
"kqueue-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue-sys"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
|
@ -562,6 +640,17 @@ version = "0.2.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"libc",
|
||||
"redox_syscall 0.5.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.11"
|
||||
|
@ -578,6 +667,15 @@ version = "0.4.20"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "markdown"
|
||||
version = "1.0.0-alpha.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6491e6c702bf7e3b24e769d800746d5f2c06a6c6a2db7992612e0f429029e81"
|
||||
dependencies = [
|
||||
"unicode-id",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.1.0"
|
||||
|
@ -637,8 +735,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi",
|
||||
"windows-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -651,6 +750,25 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "6.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"crossbeam-channel",
|
||||
"filetime",
|
||||
"fsevent-sys",
|
||||
"inotify",
|
||||
"kqueue",
|
||||
"libc",
|
||||
"log",
|
||||
"mio",
|
||||
"walkdir",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
|
@ -719,9 +837,9 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"redox_syscall 0.4.1",
|
||||
"smallvec",
|
||||
"windows-targets",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -795,6 +913,15 @@ dependencies = [
|
|||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.2"
|
||||
|
@ -857,6 +984,15 @@ version = "1.0.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
|
@ -956,7 +1092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1002,7 +1138,7 @@ dependencies = [
|
|||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1159,6 +1295,12 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-id"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10103c57044730945224467c09f71a4db0071c123a0648cc3e818913bde6b561"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
|
@ -1186,6 +1328,16 @@ version = "0.9.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
@ -1208,6 +1360,15 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
@ -1220,7 +1381,16 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1229,13 +1399,29 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1244,42 +1430,90 @@ version = "0.48.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.13.0"
|
||||
|
|
|
@ -9,6 +9,8 @@ edition = "2021"
|
|||
askama = { version = "0.12.1", features = ["with-axum"] }
|
||||
askama_axum = "0.4.0"
|
||||
axum = "0.7.2"
|
||||
markdown = "1.0.0-alpha.21"
|
||||
notify = "6.1.1"
|
||||
tokio = { version = "1.34.0", features = ["full"] }
|
||||
tower = "0.4.13"
|
||||
tower-http = { version = "0.5.0", features = ["full"] }
|
||||
|
|
158
src/main.rs
158
src/main.rs
|
@ -1,7 +1,9 @@
|
|||
use std::io::prelude::*;
|
||||
use std::fs::File;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::{collections::HashMap, fs::File};
|
||||
|
||||
use askama::Template;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{Html, IntoResponse, Response},
|
||||
|
@ -13,6 +15,36 @@ use tower_http::services::ServeDir;
|
|||
use tower_http::trace::TraceLayer;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Meta {
|
||||
title: String,
|
||||
author: String,
|
||||
description: String,
|
||||
img_path: String,
|
||||
canonical_url: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Post {
|
||||
meta: Meta,
|
||||
cover_img_path: String,
|
||||
body: String,
|
||||
}
|
||||
|
||||
/*#[derive(Template)]
|
||||
#[template(path = "includes/head.html", escape = "none")]
|
||||
struct HeadTemplate {
|
||||
styles: String,
|
||||
meta: Meta,
|
||||
}*/
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "base.html", escape = "none")]
|
||||
struct BaseTemplate {
|
||||
styles: String,
|
||||
meta: Meta,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "index.html", escape = "none")]
|
||||
struct IndexTemplate {
|
||||
|
@ -25,6 +57,29 @@ struct HomelabTemplate {
|
|||
styles: String,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blog_list.html", escape = "none")]
|
||||
struct BlogListTemplate {
|
||||
_parent: BaseTemplate,
|
||||
styles: String,
|
||||
meta: Meta,
|
||||
posts: Vec<(String, Meta)>,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "blog_post.html", escape = "none")]
|
||||
struct BlogPostTemplate {
|
||||
_parent: BaseTemplate,
|
||||
styles: String,
|
||||
meta: Meta,
|
||||
post: Post,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct AppState {
|
||||
posts: Arc<RwLock<HashMap<String, Post>>>,
|
||||
}
|
||||
|
||||
struct HtmlTemplate<T>(T);
|
||||
|
||||
impl<T> IntoResponse for HtmlTemplate<T>
|
||||
|
@ -43,24 +98,81 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
async fn homelab() -> impl IntoResponse {
|
||||
async fn blog(State(state): State<AppState>) -> Result<impl IntoResponse, StatusCode> {
|
||||
let mut styles_file = File::open("static/css/styles.css").expect("Failed to open stylesheet.");
|
||||
let mut styles = String::new();
|
||||
styles_file.read_to_string(&mut styles).expect("Failed to read stylesheet.");
|
||||
let template = HomelabTemplate { styles };
|
||||
HtmlTemplate(template)
|
||||
styles_file
|
||||
.read_to_string(&mut styles)
|
||||
.expect("Failed to read stylesheet.");
|
||||
let mut posts: Vec<(String, Meta)> = vec![];
|
||||
for (slug, post) in state.posts.read().unwrap().clone().iter() {
|
||||
posts.push((slug.clone(), post.meta.clone()));
|
||||
}
|
||||
let meta = Meta {
|
||||
title: "CBAX dot DEV Blog".into(),
|
||||
author: "Chad Baxter".into(),
|
||||
description: "An interesting place of techobabble.".into(),
|
||||
img_path: "".into(),
|
||||
canonical_url: "blog".into(),
|
||||
};
|
||||
let template = BlogListTemplate {
|
||||
_parent: BaseTemplate {
|
||||
styles: styles.clone(),
|
||||
meta: meta.clone(),
|
||||
},
|
||||
styles,
|
||||
meta,
|
||||
posts,
|
||||
};
|
||||
return Ok(HtmlTemplate(template));
|
||||
}
|
||||
|
||||
async fn index() -> impl IntoResponse {
|
||||
async fn blog_post(
|
||||
State(state): State<AppState>,
|
||||
Path(post_slug): Path<String>,
|
||||
) -> Result<impl IntoResponse, StatusCode> {
|
||||
let mut styles_file = File::open("static/css/styles.css").expect("Failed to open stylesheet.");
|
||||
let mut styles = String::new();
|
||||
styles_file.read_to_string(&mut styles).expect("Failed to read stylesheet.");
|
||||
styles_file
|
||||
.read_to_string(&mut styles)
|
||||
.expect("Failed to read stylesheet.");
|
||||
if let Some(post) = state.posts.read().unwrap().clone().get(&post_slug) {
|
||||
let meta = post.meta.clone();
|
||||
let template = BlogPostTemplate {
|
||||
_parent: BaseTemplate {
|
||||
styles: styles.clone(),
|
||||
meta: meta.clone(),
|
||||
},
|
||||
styles,
|
||||
meta,
|
||||
post: post.clone(),
|
||||
};
|
||||
return Ok(HtmlTemplate(template));
|
||||
}
|
||||
return Err(StatusCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
async fn homelab() -> Result<impl IntoResponse, StatusCode> {
|
||||
let mut styles_file = File::open("static/css/styles.css").expect("Failed to open stylesheet.");
|
||||
let mut styles = String::new();
|
||||
styles_file
|
||||
.read_to_string(&mut styles)
|
||||
.expect("Failed to read stylesheet.");
|
||||
let template = HomelabTemplate { styles };
|
||||
return Ok(HtmlTemplate(template));
|
||||
}
|
||||
|
||||
async fn index() -> Result<impl IntoResponse, StatusCode> {
|
||||
let mut styles_file = File::open("static/css/styles.css").expect("Failed to open stylesheet.");
|
||||
let mut styles = String::new();
|
||||
styles_file
|
||||
.read_to_string(&mut styles)
|
||||
.expect("Failed to read stylesheet.");
|
||||
let template = IndexTemplate { styles };
|
||||
HtmlTemplate(template)
|
||||
return Ok(HtmlTemplate(template));
|
||||
}
|
||||
|
||||
fn serve_dir() -> Router {
|
||||
// serve the file in the "assets" directory under `/assets`
|
||||
Router::new().nest_service("/res", ServeDir::new("static"))
|
||||
}
|
||||
|
||||
|
@ -73,18 +185,34 @@ async fn main() {
|
|||
)
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
|
||||
// build our application with some routes
|
||||
let state = AppState {
|
||||
posts: Arc::new(RwLock::new(HashMap::new())),
|
||||
};
|
||||
state.posts.write().unwrap().insert(
|
||||
"test_slug".into(),
|
||||
Post {
|
||||
meta: Meta {
|
||||
title: "Test Post".into(),
|
||||
author: "Chad Baxter".into(),
|
||||
description: "This is a test post".into(),
|
||||
img_path: "/res/cbax.gif".into(),
|
||||
canonical_url: "//cbax.dev/blog/test_slug".into(),
|
||||
},
|
||||
cover_img_path: "/res/covers/test.png".into(),
|
||||
body: "this is a test post!".into(),
|
||||
},
|
||||
);
|
||||
let app = Router::new()
|
||||
.route("/", get(index))
|
||||
.route("/homelab", get(homelab))
|
||||
.route("/blog", get(blog))
|
||||
.route("/blog/:post_slug", get(blog_post))
|
||||
.with_state(state)
|
||||
.fallback_service(serve_dir())
|
||||
.layer(ServiceBuilder::new().layer(TraceLayer::new_for_http()));
|
||||
.layer(ServiceBuilder::new().layer(TraceLayer::new_for_http()));
|
||||
|
||||
// run it
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:7654")
|
||||
.await
|
||||
.unwrap();
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:7654").await.unwrap();
|
||||
println!("listening on {}", listener.local_addr().unwrap());
|
||||
tracing::debug!("listening on {}", listener.local_addr().unwrap());
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
|
|
42
static/css/colors.css
Normal file
42
static/css/colors.css
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* ---------------- Colors ---------------- */
|
||||
|
||||
|
||||
:root {
|
||||
/* root default is dark */
|
||||
color-scheme: dark;
|
||||
|
||||
--bg-color: var(--nord0);
|
||||
--text-color: var(--nord4);
|
||||
|
||||
--highlight-color: var(--nord8);
|
||||
--highlight-color-rgb: 133, 64, 201;
|
||||
}
|
||||
|
||||
/* Detect which mode the user prefers */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
/* root values for darkmode (best) users :3 */
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
|
||||
--bg-color: var(--nord0);
|
||||
--text-color: var(--nord4);
|
||||
|
||||
--highlight-color: var(--nord8);
|
||||
--highlight-color-rgb: 133, 64, 201;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
|
||||
/* root values for lightmode (eww) users... */
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
--bg-color: var(--nord4);
|
||||
--text-color: var(--nord0);
|
||||
|
||||
--highlight-color: var(--nord8);
|
||||
--highlight_color-rgb: 181, 122, 240;
|
||||
}
|
||||
}
|
208
static/css/components.css
Normal file
208
static/css/components.css
Normal file
|
@ -0,0 +1,208 @@
|
|||
/* ---------------- Components ---------------- */
|
||||
|
||||
|
||||
/* -------- General components -------- */
|
||||
|
||||
|
||||
.flex-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
|
||||
/* -------- Tree components -------- */
|
||||
|
||||
|
||||
.tree li, .tree ul li {
|
||||
margin-left: 15px;
|
||||
position: relative;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.tree li::before, .tree ul li::before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
background-color: var(--text-color);
|
||||
top: 5px;
|
||||
bottom: -12px;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
.tree>li:first-child::before {
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
.tree li:not(:first-child):last-child::before, .tree ul li:not(:first-child):last-child::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tree li:only-child::before, .tree ul li:only-child::before {
|
||||
display: list-item;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
background-color: var(--text-color);
|
||||
top: 5px;
|
||||
bottom: 7px;
|
||||
height: 7px;
|
||||
left: -10px;
|
||||
}
|
||||
|
||||
.tree li::after, .tree ul li::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
width: 10px;
|
||||
height: 1px;
|
||||
background-color: var(--text-color);
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
|
||||
/* -------- Form components -------- */
|
||||
|
||||
|
||||
.input-form {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
border: 1px solid var(--highlight-color);
|
||||
}
|
||||
|
||||
.input-form input {
|
||||
width: 100%;
|
||||
padding: 0.5rem 1rem;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
outline: none;
|
||||
transition-duration: 0.5s;
|
||||
background-color: var(--bg-color);
|
||||
}
|
||||
|
||||
.input-form input:hover,
|
||||
.input-form input:focus {
|
||||
background-color: rgba(var(--highlight-color-rgb), 0.15);
|
||||
}
|
||||
|
||||
.input-form button {
|
||||
padding: 0.5rem 1rem;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition-duration: 0.5s;
|
||||
color: var(--text-color);
|
||||
background-color: rgba(var(--highlight-color-rgb), 0.15);
|
||||
}
|
||||
|
||||
.input-form button:hover {
|
||||
background-color: var(--highlight-color);
|
||||
}
|
||||
|
||||
.input-form ::placeholder {
|
||||
color: var(--text-color);
|
||||
opacity: 1;
|
||||
/* Firefox */
|
||||
}
|
||||
|
||||
.input-form ::-ms-input-placeholder {
|
||||
/* Edge 12 -18 */
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
|
||||
/* -------- Button components --------*/
|
||||
|
||||
|
||||
.button {
|
||||
margin: 0.5rem;
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid var(--highlight-color);
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
transition-duration: 0.5s;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: var(--highlight-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hover-button:hover {
|
||||
margin: 0.5rem 1rem 1rem 0.5rem;
|
||||
box-shadow: 0.5rem 0.5rem 0rem rgba(var(--highlight-color-rgb), 0.3);
|
||||
}
|
||||
|
||||
.button:active {
|
||||
transition-duration: 0s;
|
||||
background-color: rgba(var(--highlight-color-rgb), 0.15);
|
||||
}
|
||||
|
||||
.copy-button {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
||||
/* -------- Box components -------- */
|
||||
|
||||
|
||||
.box {
|
||||
margin: 0.5rem;
|
||||
padding: 1rem;
|
||||
border: 1px solid var(--highlight-color);
|
||||
}
|
||||
|
||||
|
||||
/* -------- Component modifiers -------- */
|
||||
|
||||
|
||||
.float-end {
|
||||
float: inline-end;
|
||||
}
|
||||
|
||||
.float-start {
|
||||
float: inline-start;
|
||||
}
|
||||
|
||||
|
||||
.box-hover {
|
||||
transition-duration: 0.5s;
|
||||
}
|
||||
|
||||
.box-hover:hover {
|
||||
background-color: rgba(var(--highlight-color-rgb), 0.15);
|
||||
margin: 0.5rem 1rem 1rem 0.5rem;
|
||||
box-shadow: 0.5rem 0.5rem 0rem rgba(var(--highlight-color-rgb), 0.3);
|
||||
}
|
||||
|
||||
.box-code {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
background-color: rgba(var(--highlight-color-rgb), 0.15);
|
||||
}
|
||||
|
||||
.box-pop {
|
||||
margin: 0.5rem 1rem 1rem 0.5rem;
|
||||
box-shadow: 0.5rem 0.5rem 0rem rgba(var(--highlight-color-rgb), 0.3);
|
||||
}
|
||||
|
||||
.box-fit {
|
||||
width: fit-content;
|
||||
height: fit-content;
|
||||
}
|
||||
|
||||
.box-stealth {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
109
static/css/core.css
Normal file
109
static/css/core.css
Normal file
|
@ -0,0 +1,109 @@
|
|||
:root {}
|
||||
|
||||
/* if we ever need it, its there :3 */
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
/* get the body in shape nya~ */
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 100vh;
|
||||
max-width: 100vw;
|
||||
text-decoration: none;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "SpaceMono", monospace, sans-serif;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------- Text formatting ---------------- */
|
||||
|
||||
|
||||
b,
|
||||
strong,
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
i,
|
||||
em,
|
||||
.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
i b,
|
||||
i strong,
|
||||
em b,
|
||||
em strong,
|
||||
b i,
|
||||
strong i,
|
||||
b em,
|
||||
strong em,
|
||||
.bolditalic {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
noscript {
|
||||
display: block;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
/* h2 */
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: bold;
|
||||
text-decoration: dotted underline;
|
||||
color: var(--highlight-color);
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
padding: 1rem;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
code {
|
||||
display: block;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* ---------------- Highlighting ---------------- */
|
||||
|
||||
|
||||
::selection {
|
||||
background: var(--highlight-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.highlight-bg::selection,
|
||||
.highlight-bg ::selection {
|
||||
background: var(--text-color);
|
||||
color: var(--bg-color);
|
||||
}
|
||||
|
||||
.highlight-text {
|
||||
color: var(--highlight-color);
|
||||
}
|
||||
|
||||
.highlight-bg {
|
||||
background-color: var(--highlight-color);
|
||||
}
|
||||
|
||||
.highlight-bg-15 {
|
||||
background-color: rgba(var(--highlight-color-rgb), 0.15);
|
||||
}
|
42
static/css/font.css
Normal file
42
static/css/font.css
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* ---------------- Font ---------------- */
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: "SpaceMono";
|
||||
src:
|
||||
local("SpaceMono"),
|
||||
url("/res/ttf/SpaceMono-Regular.ttf") format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
/* Regular */
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "SpaceMono";
|
||||
src:
|
||||
local("SpaceMono-Bold"),
|
||||
url("/res/ttf/SpaceMono-Bold.ttf") format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
/* Bold */
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "SpaceMono";
|
||||
src:
|
||||
local("SpaceMono-Italic"),
|
||||
url("/res/ttf/SpaceMono-Italic.ttf") format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
/* Italic */
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "SpaceMono";
|
||||
src:
|
||||
local("SpaceMono-BoldItalic"),
|
||||
url("/res/ttf/SpaceMono-BoldItalic.ttf") format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
/* Bold Italic */
|
||||
}
|
|
@ -29,24 +29,20 @@ Styleguide Nord
|
|||
|
||||
Used for texts, backgrounds, carets and structuring characters like curly- and square brackets.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#2e3440; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Polar Night
|
||||
*/
|
||||
--nord0: #2e3440;
|
||||
--nord0-rgb: 46, 52, 64;
|
||||
|
||||
/*
|
||||
Lighter shade color of the base component color.
|
||||
|
||||
Used as a lighter background color for UI elements like status bars.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#3b4252; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Polar Night
|
||||
*/
|
||||
--nord1: #3b4252;
|
||||
--nord1-rgb: 59, 66, 82;
|
||||
|
||||
/*
|
||||
Lighter shade color of the base component color.
|
||||
|
@ -54,12 +50,10 @@ Styleguide Nord
|
|||
Used as line highlighting in the editor.
|
||||
In the UI scope it may be used as selection- and highlight color.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#434c5e; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Polar Night
|
||||
*/
|
||||
--nord2: #434c5e;
|
||||
--nord2-rgb: 67, 76, 94;
|
||||
|
||||
/*
|
||||
Lighter shade color of the base component color.
|
||||
|
@ -67,12 +61,10 @@ Styleguide Nord
|
|||
Used for comments, invisibles, indent- and wrap guide marker.
|
||||
In the UI scope used as pseudoclass color for disabled elements.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#4c566a; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Polar Night
|
||||
*/
|
||||
--nord3: #4c566a;
|
||||
--nord3-rgb: 76, 86, 106;
|
||||
|
||||
/*
|
||||
Base component color of "Snow Storm".
|
||||
|
@ -80,12 +72,10 @@ Styleguide Nord
|
|||
Main color for text, variables, constants and attributes.
|
||||
In the UI scope used as semi-light background depending on the theme shading design.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#d8dee9; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Snow Storm
|
||||
*/
|
||||
--nord4: #d8dee9;
|
||||
--nord4-rgb: 216, 222, 233;
|
||||
|
||||
/*
|
||||
Lighter shade color of the base component color.
|
||||
|
@ -93,12 +83,10 @@ Styleguide Nord
|
|||
Used as a lighter background color for UI elements like status bars.
|
||||
Used as semi-light background depending on the theme shading design.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#e5e9f0; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Snow Storm
|
||||
*/
|
||||
--nord5: #e5e9f0;
|
||||
--nord5-rgb: 229, 233, 240;
|
||||
|
||||
/*
|
||||
Lighter shade color of the base component color.
|
||||
|
@ -106,24 +94,20 @@ Styleguide Nord
|
|||
Used for punctuations, carets and structuring characters like curly- and square brackets.
|
||||
In the UI scope used as background, selection- and highlight color depending on the theme shading design.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#eceff4; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Snow Storm
|
||||
*/
|
||||
--nord6: #eceff4;
|
||||
--nord6-rgb: 236, 239, 244;
|
||||
|
||||
/*
|
||||
Bluish core color.
|
||||
|
||||
Used for classes, types and documentation tags.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#8fbcbb; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Frost
|
||||
*/
|
||||
--nord7: #8fbcbb;
|
||||
--nord7-rgb: 143, 188, 187;
|
||||
|
||||
/*
|
||||
Bluish core accent color.
|
||||
|
@ -135,12 +119,10 @@ Styleguide Nord
|
|||
- Markup quotes
|
||||
- Markup link URLs
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#88c0d0; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Frost
|
||||
*/
|
||||
--nord8: #88c0d0;
|
||||
--nord8-rgb: 136, 192, 208;
|
||||
|
||||
/*
|
||||
Bluish core color.
|
||||
|
@ -148,48 +130,40 @@ Styleguide Nord
|
|||
Used for language-specific syntactic/reserved support characters and keywords, operators, tags, units and
|
||||
punctuations like (semi)colons,commas and braces.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#81a1c1; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Frost
|
||||
*/
|
||||
--nord9: #81a1c1;
|
||||
--nord9-rgb: 129, 161, 193;
|
||||
|
||||
/*
|
||||
Bluish core color.
|
||||
|
||||
Used for markup doctypes, import/include/require statements, pre-processor statements and at-rules (`@`).
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#5e81ac; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Frost
|
||||
*/
|
||||
--nord10: #5e81ac;
|
||||
--nord10-rgb: 94, 129, 172;
|
||||
|
||||
/*
|
||||
Colorful component color.
|
||||
|
||||
Used for errors, git/diff deletion and linter marker.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#bf616a; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Aurora
|
||||
*/
|
||||
--nord11: #bf616a;
|
||||
--nord11-rgb: 191, 97, 106;
|
||||
|
||||
/*
|
||||
Colorful component color.
|
||||
|
||||
Used for annotations.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#d08770; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Aurora
|
||||
*/
|
||||
--nord12: #d08770;
|
||||
--nord12-rgb: 208, 135, 112;
|
||||
|
||||
/*
|
||||
Colorful component color.
|
||||
|
@ -197,12 +171,10 @@ Styleguide Nord
|
|||
Used for escape characters, regular expressions and markup entities.
|
||||
In the UI scope used for warnings and git/diff renamings.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#ebcb8b; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Aurora
|
||||
*/
|
||||
--nord13: #ebcb8b;
|
||||
--nord13-rgb: 235, 203, 139;
|
||||
|
||||
/*
|
||||
Colorful component color.
|
||||
|
@ -210,22 +182,18 @@ Styleguide Nord
|
|||
Main color for strings and attribute values.
|
||||
In the UI scope used for git/diff additions and success visualizations.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#a3be8c; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Aurora
|
||||
*/
|
||||
--nord14: #a3be8c;
|
||||
--nord14-rgb: 163, 190, 140;
|
||||
|
||||
/*
|
||||
Colorful component color.
|
||||
|
||||
Used for numbers.
|
||||
|
||||
Markup:
|
||||
<div style="background-color:#b48ead; width=60; height=60"></div>
|
||||
|
||||
Styleguide Nord - Aurora
|
||||
*/
|
||||
--nord15: #b48ead;
|
||||
--nord15-rgb: 180, 142, 173;
|
||||
}
|
||||
|
|
BIN
static/ttf/SpaceMono-Bold.ttf
Normal file
BIN
static/ttf/SpaceMono-Bold.ttf
Normal file
Binary file not shown.
BIN
static/ttf/SpaceMono-Italic.ttf
Normal file
BIN
static/ttf/SpaceMono-Italic.ttf
Normal file
Binary file not shown.
BIN
static/ttf/SpaceMono-Regular.ttf
Normal file
BIN
static/ttf/SpaceMono-Regular.ttf
Normal file
Binary file not shown.
12
templates/base.html
Normal file
12
templates/base.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
{% include "head.html" %}
|
||||
<body>
|
||||
<main>
|
||||
{% include "nav.html" %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
{% include "footer.html" %}
|
||||
</body>
|
||||
</html>
|
8
templates/blog_list.html
Normal file
8
templates/blog_list.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% for (slug, post) in posts %}
|
||||
{% if loop.first %}<div class="new_callout">NEW!</div>{% endif %}
|
||||
<a href="/blog/{{ slug }}"><h2>{{ post.title }}</h2></a>
|
||||
<p>{{ post.description }}</p>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
8
templates/blog_post.html
Normal file
8
templates/blog_post.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1>{{ post.meta.title }}</h1>
|
||||
<img src="{{ post.cover_img_path }}"></img>
|
||||
<article>
|
||||
{{ post.body }}
|
||||
</article>
|
||||
{% endblock %}
|
3
templates/footer.html
Normal file
3
templates/footer.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<footer>
|
||||
<p>Copyright 2024 cbax</p>
|
||||
</footer>
|
23
templates/head.html
Normal file
23
templates/head.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="language" content="EN">
|
||||
<title>{{ meta.title }}</title>
|
||||
<style>
|
||||
{{ styles }}
|
||||
</style>
|
||||
<meta name="title" content="{{ meta.title }}">
|
||||
<meta name="description" content="{{ meta.description }}">
|
||||
<meta name="author" content="{{ meta.author }}">
|
||||
<meta name="canonical" content="{{ meta.canonical_url }}">
|
||||
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:url" content="{{ meta.canonical_url }}">
|
||||
<meta property="og:title" content="{{ meta.title }}">
|
||||
<meta property="og:description" content="{{ meta.description }}">
|
||||
<meta property="og:image" content="{{ meta.img_path }}">
|
||||
|
||||
<meta property="twitter:card" content="summary_large_image">
|
||||
<meta property="twitter:url" content="{{ meta.canonical_url }}">
|
||||
<meta property="twitter:title" content="{{ meta.title }}">
|
||||
<meta property="twitter:description" content="{{ meta.description }}">
|
||||
<meta property="twitter:image" content="{{ meta.img_path }}">
|
13
templates/meta.svg
Normal file
13
templates/meta.svg
Normal file
|
@ -0,0 +1,13 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 630">
|
||||
<defs>
|
||||
<pattern id="img" x="0" y="0" width="1" height="1" viewBox="0 0 500 500" preserveAspectRatio="xMidYMid slice">
|
||||
<image width="500" height="500" href="{{ meta_img_path }}"/>
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect width="1200" height="630" fill="black" />
|
||||
<rect width="400" height="400" x="200" y="115" fill="url(#img)" />
|
||||
<text x="630" y="330" font-size="100px" fill="#ffffff" font-family="Inter" >
|
||||
{{ text }}
|
||||
</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 541 B |
3
templates/nav.html
Normal file
3
templates/nav.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<nav>
|
||||
<a href="/">Home</a>
|
||||
</nav>
|
Loading…
Reference in a new issue