···11use chrono::{Datelike, Month};
22use indexmap::{IndexMap, IndexSet};
33-use minijinja::Environment;
43use serde::Serialize;
54use thiserror::Error;
6577-use crate::{
88- page::{Item, PostLink},
99- templates::component::Component,
1010-};
66+use crate::page::{Item, PostLink};
117128/// A data structure that maps each post to Y -> M -> D -> posts, preserving the order of
139/// the posts.
···42384339 Ok(Archive(year_map))
4440 }
4545-}
4646-4747-impl<'e> Component for Archive<'e> {
4848- const VIEW_NAME: &'static str = "archive";
4941}
50425143#[allow(dead_code)]
+2-28
lx/src/data/config.rs
···4444pub use serial::NavItem;
45454646pub mod serial {
4747- use std::{collections::HashMap, fmt::Display, sync::Arc};
4747+ use std::{collections::HashMap, fmt::Display};
48484949 use camino::{Utf8Path, Utf8PathBuf};
5050- use minijinja::{Environment, State, Value, value::Object};
5150 use normalize_path::NormalizePath as _;
5251 use serde::{Deserialize, Serialize};
5352 use thiserror::Error;
54535555- use crate::{data::email::Email, templates::component::Component};
5454+ use crate::data::email::Email;
56555756 #[derive(Serialize, Deserialize, Debug)]
5857 pub struct Config {
···117116 pub enum NavItem {
118117 Separator,
119118 Page { title: String, path: String },
120120- }
121121-122122- // NOTE(2025-10-09): this currently never gets hit when accessing via a template
123123- // invocation that goes through `Config`, because `Config` and `NavItem` both
124124- // implement `Serialize`, and so by the time the renderer is working with the
125125- // `Config::nav` data, it is working with it as the *serialized* version of it,
126126- // which means it never actually has a chance to see the `Component` version of it.
127127- // In practice, this likely means that I need to get rid of the `Serialize` bound on
128128- // `Component` and require custom rendering at each site (ugh) or find some other
129129- // way to express these kinds of relations. _Le sigh_.
130130- //
131131- // TODO: also maybe move this elsewhere?
132132- impl Component for NavItem {
133133- const VIEW_NAME: &'static str = "nav-item";
134134- }
135135-136136- impl Object for NavItem {
137137- fn call(
138138- self: &Arc<Self>,
139139- state: &State<'_, '_>,
140140- _args: &[Value],
141141- ) -> Result<Value, minijinja::Error> {
142142- println!("got here?");
143143- self.view(state.env()).map(Value::from)
144144- }
145119 }
146120147121 #[derive(Error, Debug)]