···55use thiserror::Error;
6677use crate::{
88- page::{Item, Post, PostLink},
99- templates::view::{self, View},
88+ page::{Item, PostLink},
99+ templates::component::Component,
1010};
11111212/// A data structure that maps each post to Y -> M -> D -> posts, preserving the order of
···4444 }
4545}
46464747-impl<'e> View for Archive<'e> {
4747+impl<'e> Component for Archive<'e> {
4848 const VIEW_NAME: &'static str = "archive";
49495050 fn view(&self, env: &Environment) -> Result<String, minijinja::Error> {
+2-5
lx/src/data/config.rs
···5252 use serde::{Deserialize, Serialize};
5353 use thiserror::Error;
54545555- use crate::{
5656- data::email::Email,
5757- templates::view::{self, View},
5858- };
5555+ use crate::{data::email::Email, templates::component::Component};
59566057 #[derive(Serialize, Deserialize, Debug)]
6158 pub struct Config {
···123120 }
124121125122 // TODO: maybe move this elsewhere?
126126- impl View for NavItem {
123123+ impl Component for NavItem {
127124 const VIEW_NAME: &'static str = "nav-item";
128125129126 fn view(&self, env: &Environment) -> Result<String, minijinja::Error> {
···11+{#
22+ TODO: should this be a component, a macro, something else? I definitely do not like
33+ having it with implicit context of `config`.
44+#}
55+<author>
66+ <name>{{config.author.name}}</name>
77+ <email>{{config.author.email}}</email>
88+ <uri>{{config.url}}</uri>
99+</author>
-48
sites/v6/_ui/views/archive.jinja
···11-{# TODO: this doesn't need to be a macro, but can still be callable via `View`. #}
22-{# TODO: this (pulled directly from v5) needs to be reworked a bit in terms of the new
33- data structures I am using here. The “view” for an `Archive` may end up being best
44- represented by something other than the `Archive` type’s own use of the `IndexMap`,
55- like an iterator over it or such?
66-#}
77-{#{% macro list(collection, idByCollection=false) %}#}
88-<ul class='archive-list'>
99-{%- for (year, months) in archive %}
1010-<li class='year'>
1111- <div class='year-info sticky'>
1212- <h2 class='year-title date'>{{year}}</h2>
1313- </div>
1414- <ul class='year-items'>
1515- {%- for (month, days) in months %}
1616- <li class='month'>
1717- {# TODO: `month.name` is not yet callable. #}
1818- <h3 class='month-title date'><span class='month-sticky'>{{month.name()}}</span></h3>
1919- <ul class='month-items'>
2020- {%- for (day, post_links) in days %}
2121- <li class='day'>
2222- {# TODO: `day.name` is not yet callable. #}
2323- <h4 class='day-title date'><span class='day-sticky'>{{day.name()}}</span></h4>
2424- <ul class='day-items'>
2525- {%- for post_link in post_links %}
2626- <li class='item'>
2727- <h5 class='item-title'>{{post_link()}}</h5>
2828- {% if item.data.subtitle -%}
2929- <p class='item-subtitle'>{{item.data.subtitle | safe}}</p>
3030- {%- endif %}
3131- {%- if not item.data.title %}
3232- <article class='item-content article-content'>
3333- {{item.templateContent | safe}}
3434- </article>
3535- {% endif -%}
3636- </li>
3737- {% endfor -%}
3838- </ul>
3939- </li>
4040- {% endfor -%}
4141- </ul>
4242- </li>
4343- {%- endfor -%}
4444- </ul>
4545-</li>
4646-{% endfor -%}
4747-</ul>
4848-{#{% endmacro %}#}