add a tagging system to the website
This commit is contained in:
parent
701da6bc4b
commit
e1b6578b2a
97 changed files with 1025 additions and 979 deletions
|
@ -10,7 +10,7 @@ use std::{ops::ControlFlow, sync::Arc};
|
|||
use atom::FeedDir;
|
||||
use chrono::{DateTime, Utc};
|
||||
use dir_helper::DirHelper;
|
||||
use handlebars::{handlebars_helper, Handlebars};
|
||||
use handlebars::{Handlebars, handlebars_helper};
|
||||
use include_static_helper::IncludeStaticHelper;
|
||||
use serde::Serialize;
|
||||
use tracing::{error, info_span, instrument};
|
||||
|
@ -26,8 +26,8 @@ use crate::{
|
|||
},
|
||||
sources::Sources,
|
||||
vfs::{
|
||||
self, layered_dir, AnchoredAtExt, Cd, Content, ContentCache, Dir, DynDir, HtmlCanonicalize,
|
||||
MemDir, ToDynDir, VPath, VPathBuf,
|
||||
self, AnchoredAtExt, Cd, Content, ContentCache, Dir, DynDir, HtmlCanonicalize, MemDir,
|
||||
ToDynDir, VPath, VPathBuf, layered_dir,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -37,7 +37,6 @@ struct BaseTemplateData<'a> {
|
|||
import_map: String,
|
||||
season: Option<Season>,
|
||||
dev: bool,
|
||||
feeds: Vec<String>,
|
||||
}
|
||||
|
||||
impl<'a> BaseTemplateData<'a> {
|
||||
|
@ -48,7 +47,6 @@ impl<'a> BaseTemplateData<'a> {
|
|||
.expect("import map should be serializable to JSON"),
|
||||
season: Season::current(),
|
||||
dev: cfg!(debug_assertions),
|
||||
feeds: sources.treehouse.feeds_by_name.keys().cloned().collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,12 +71,12 @@ fn create_handlebars(site: &str, static_: DynDir) -> Handlebars<'static> {
|
|||
#[instrument(skip(handlebars))]
|
||||
fn load_templates(handlebars: &mut Handlebars, dir: &dyn Dir) {
|
||||
vfs::walk_dir_rec(dir, VPath::ROOT, &mut |path| {
|
||||
if path.extension() == Some("hbs") {
|
||||
if let Some(content) = vfs::query::<Content>(dir, path).and_then(|c| c.string().ok()) {
|
||||
let _span = info_span!("register_template", ?path).entered();
|
||||
if let Err(err) = handlebars.register_template_string(path.as_str(), content) {
|
||||
error!("in template: {err}");
|
||||
}
|
||||
if path.extension() == Some("hbs")
|
||||
&& let Some(content) = vfs::query::<Content>(dir, path).and_then(|c| c.string().ok())
|
||||
{
|
||||
let _span = info_span!("register_template", ?path).entered();
|
||||
if let Err(err) = handlebars.register_template_string(path.as_str(), content) {
|
||||
error!("in template: {err}");
|
||||
}
|
||||
}
|
||||
ControlFlow::Continue(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue