krik 0.1.27

A fast static site generator written in Rust with internationalization, theming, and modern web features
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::parser::Document;

use super::context::is_post;

pub fn determine_template_name(document: &Document) -> String {
    if let Some(layout) = document
        .front_matter
        .extra
        .get("layout")
        .and_then(|v| v.as_str())
    {
        format!("{layout}.html")
    } else if is_post(document) {
        "post.html".to_string()
    } else {
        "page.html".to_string()
    }
}