summaryrefslogtreecommitdiff
path: root/src/layout.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-02-13 19:48:42 +0100
committermetamuffin <metamuffin@disroot.org>2023-02-13 19:48:42 +0100
commitc4d99ef7307c238244c975e45ae1e24c923538b6 (patch)
treea80ce5de4547fff8347aeaa3e4b9cf48adfe75b2 /src/layout.rs
parentba4d782687b5eb8d91fd881a7cb9d0adce7dd9f0 (diff)
downloadmetamuffin-website-c4d99ef7307c238244c975e45ae1e24c923538b6.tar
metamuffin-website-c4d99ef7307c238244c975e45ae1e24c923538b6.tar.bz2
metamuffin-website-c4d99ef7307c238244c975e45ae1e24c923538b6.tar.zst
prepare for blog stuff
Diffstat (limited to 'src/layout.rs')
-rw-r--r--src/layout.rs30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/layout.rs b/src/layout.rs
index c553990..421f50e 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -1,10 +1,15 @@
/*
- This file is part of metamuffins website (https://codeberg.org/metamuffin/website)
- which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
- Copyright (C) 2023 metamuffin <metamuffin.org>
+This file is part of metamuffins website (https://codeberg.org/metamuffin/website)
+which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
+Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-use crate::pages::*;
-use crate::source::*;
+
+use crate::blog::rocket_uri_macro_r_blog;
+use crate::pages::{
+ rocket_uri_macro_r_about, rocket_uri_macro_r_contact, rocket_uri_macro_r_pgp_key,
+ rocket_uri_macro_r_projects,
+};
+use crate::source::rocket_uri_macro_r_source;
use crate::uri;
use markup::Render;
use rocket::{
@@ -15,7 +20,7 @@ use rocket::{
use std::io::Cursor;
markup::define! {
- Layout<Main: Render>(title: String, main: Main, noimg: bool) {
+ ScaffoldImpl<Main: Render>(title: String, main: Main, noimg: bool) {
@markup::doctype()
html {
head {
@@ -26,11 +31,11 @@ markup::define! {
h1 { "metamuffin's personal website" }
nav {
a[href=uri!(r_about())] { "About" } " "
+ a[href=uri!(r_blog())] { "Blog" } " "
a[href=uri!(r_projects())] { "Projects" } " "
a[href=uri!(r_contact())] { "Contact" } " "
a[href="https://codeberg.org/metamuffin"] { "Codeberg" } " "
a[href=uri!(r_pgp_key())] { "PGP-Key" } " "
- a[href=uri!(r_source())] { "Sources" } " "
}
hr;
section { @main }
@@ -38,7 +43,8 @@ markup::define! {
footer {
p {
"metamuffin's website; version " @include_str!("../.git/refs/heads/main")[0..10] "; "
- "sources available on " a[href="https://codeberg.org/metamuffin/website"] { "codeberg" }
+ "sources available on " a[href=uri!(r_source())] { "this page itself" }
+ " and on " a[href="https://codeberg.org/metamuffin/website"] { "codeberg" }
}
}
}
@@ -46,17 +52,17 @@ markup::define! {
}
}
-pub type DynLayoutPage<'a> = LayoutPage<markup::DynRender<'a>>;
+pub type DynScaffold<'a> = Scaffold<markup::DynRender<'a>>;
-pub struct LayoutPage<T> {
+pub struct Scaffold<T> {
pub title: String,
pub content: T,
}
-impl<'r, Main: Render> Responder<'r, 'static> for LayoutPage<Main> {
+impl<'r, Main: Render> Responder<'r, 'static> for Scaffold<Main> {
fn respond_to(self, _req: &'r Request<'_>) -> response::Result<'static> {
let mut out = String::new();
- Layout {
+ ScaffoldImpl {
main: self.content,
noimg: self.title == "Source",
title: self.title,