Rust library to generate static websites
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add example hello world

+17 -4
+1 -1
crates/user-example/src/main.rs
··· 3 3 generate_pages_mod!(); 4 4 5 5 fn main() -> Result<BuildOutput, Box<dyn std::error::Error>> { 6 - coronate(routes![Index, DynamicExample, Endpoint]) 6 + coronate(routes![Index, DynamicExample, Endpoint, HelloWorld]) 7 7 }
+3 -3
crates/user-example/src/pages/endpoint.rs
··· 12 12 // Return some JSON 13 13 RenderResult::Text(format!( 14 14 r#"{{ 15 - "image": "{}", 16 - "script": "{}" 17 - }}"#, 15 + "image": "{}", 16 + "script": "{}" 17 + }}"#, 18 18 image.path.to_string_lossy(), 19 19 some_script.path.to_string_lossy() 20 20 ))
+13
crates/user-example/src/pages/hello_world.rs
··· 1 + use maud::html; 2 + use maudit::page::prelude::*; 3 + 4 + #[route("/hello-world")] 5 + pub struct HelloWorld; 6 + 7 + impl Page for HelloWorld { 8 + fn render(&self, _: &mut RouteContext) -> RenderResult { 9 + RenderResult::Html(html! { 10 + h1 { "Hello World" } 11 + }) 12 + } 13 + }