feat: allow subdirs in posts directory #86

Merged
Anri merged 4 commits from posts-subdir into main 2024-11-14 17:48:08 +01:00
5 changed files with 7 additions and 22 deletions
Showing only changes of commit 6c16315a07 - Show all commits

View file

@ -13,8 +13,8 @@ use crate::routes::{
mod config;
mod template;
mod utils;
mod routes;
mod utils;
#[actix_web::main]
async fn main() -> Result<()> {

View file

@ -1,4 +1,4 @@
use crate::{config::Config, utils::misc::get_url, template::InfosPage};
use crate::{config::Config, template::InfosPage, utils::misc::get_url};
use actix_web::{get, http::header::ContentType, routes, web, HttpResponse, Responder};
use cached::proc_macro::once;
use ramhorns::Content;

View file

@ -4,8 +4,8 @@ use ramhorns::Content;
use crate::{
config::Config,
utils::misc::{get_url, Html},
template::{InfosPage, NavBar},
utils::misc::{get_url, Html},
};
pub async fn page(config: web::Data<Config>) -> impl Responder {

View file

@ -36,21 +36,12 @@ fn build_page(config: Config) -> String {
let ext = ".md";
// Get about
let about = read_file(
format!("{projects_dir}/about.md"),
MType::Generic,
);
let about = read_file(format!("{projects_dir}/about.md"), MType::Generic);
// Get apps
let apps = glob(&format!("{apps_dir}/*{ext}"))
.unwrap()
.map(|e| {
read_file(
e.unwrap().to_string_lossy().to_string(),
MType::Portfolio,
)
.unwrap()
})
.map(|e| read_file(e.unwrap().to_string_lossy().to_string(), MType::Portfolio).unwrap())
.collect::<Vec<File>>();
let appdata = if apps.is_empty() {
@ -62,13 +53,7 @@ fn build_page(config: Config) -> String {
// Get archived apps
let archived_apps = glob(&format!("{apps_dir}/archive/*{ext}"))
.unwrap()
.map(|e| {
read_file(
e.unwrap().to_string_lossy().to_string(),
MType::Portfolio,
)
.unwrap()
})
.map(|e| read_file(e.unwrap().to_string_lossy().to_string(), MType::Portfolio).unwrap())
.collect::<Vec<File>>();
let archived_appdata = if archived_apps.is_empty() {

View file

@ -3,8 +3,8 @@ use cached::proc_macro::once;
use crate::{
config::Config,
utils::misc::{make_kw, Html},
template::InfosPage,
utils::misc::{make_kw, Html},
};
#[get("/web3")]