ruskit/app/controllers/
pages.rs

1use askama::Template;
2use askama_axum::Response;
3use crate::framework::views::{Metadata, TemplateExt, HasMetadata};
4use axum::response::Html;
5
6
7/// About page template with custom fields
8#[derive(Template, Default)]
9#[template(path = "about.html")]
10pub struct AboutTemplate {
11    pub first_name: String,
12    pub last_name: String,
13}
14
15/// Landing page template
16#[derive(Template)]
17#[template(path = "landing.html")]
18pub struct LandingTemplate;
19
20
21/// Renders the about page with team member information
22pub async fn about() -> Response {
23    let mut about_template = AboutTemplate::with_metadata(
24        Metadata::new("About Us")
25            .with_description("Learn more about our team")
26            .with_og_title("About Us")
27            .with_og_description("Meet John Doe, a key member of our team")
28    );
29    
30    about_template.first_name = "John".to_string();
31    about_template.last_name = "Doe".to_string();
32    
33    about_template.into_response()
34}
35
36/// Renders the landing page
37pub async fn landing() -> Html<String> {
38    let template = LandingTemplate;
39    Html(template.render().unwrap())
40}