Merge asset and page server

This commit is contained in:
2025-11-08 09:33:12 -08:00
parent 6cb54c2300
commit e70170ee5b
18 changed files with 279 additions and 621 deletions

View File

@@ -1,15 +1,11 @@
use assetserver::Asset;
use chrono::TimeDelta;
use maud::{DOCTYPE, Markup, PreEscaped, html};
use page::page::{Page, PageMetadata};
use std::pin::Pin;
use crate::{
components::{
md::{Markdown, backlinks, meta_from_markdown},
misc::FarLink,
},
routes::assets::{Image_Icon, Styles_Main},
use crate::components::{
md::{Markdown, backlinks, meta_from_markdown},
misc::FarLink,
};
mod handouts;
@@ -26,20 +22,23 @@ pub fn links() -> Page {
http://www.3dprintmath.com/
*/
page_from_markdown(include_str!("links.md"), Some(Image_Icon::URL.to_owned()))
page_from_markdown(
include_str!("links.md"),
Some("/assets/img/icon.png".to_string()),
)
}
pub fn betalupi() -> Page {
page_from_markdown(
include_str!("betalupi.md"),
Some(Image_Icon::URL.to_owned()),
Some("/assets/img/icon.png".to_string()),
)
}
pub fn htwah_typesetting() -> Page {
page_from_markdown(
include_str!("htwah-typesetting.md"),
Some(Image_Icon::URL.to_owned()),
Some("/assets/img/icon.png".to_string()),
)
}
@@ -66,6 +65,7 @@ fn page_from_markdown(md: impl Into<String>, default_image: Option<String>) -> P
Page {
meta,
immutable: true,
html_ttl: Some(TimeDelta::seconds(60 * 24 * 30)),
generate_html: Box::new(move |page, ctx| {
@@ -104,7 +104,7 @@ pub fn page_wrapper<'a>(
meta content="text/html; charset=UTF-8" http-equiv="content-type" {}
meta property="og:type" content="website" {}
link rel="stylesheet" href=(Styles_Main::URL) {}
link rel="stylesheet" href=("/assets/css/main.css") {}
(&meta)
title { (PreEscaped(meta.title.clone())) }