diff --git a/content/echoes/the-realm-s-secrets.dj b/content/echoes/the-realm-s-secrets.dj index 9ec4d25..32292f7 100644 --- a/content/echoes/the-realm-s-secrets.dj +++ b/content/echoes/the-realm-s-secrets.dj @@ -5,7 +5,7 @@ created_at = "2025-03-03T18:42:56+01:00" { role=description } ::: -An overview of the inner workings and technical decisions behind this website, including my reasons for choosing [djot](https://djot.net/) over markdown, rendering LaTeX quickly, templating without needless allocations, and more. +An overview of the inner workings and technical decisions behind this website, including my reasons for choosing [djot](https://djot.net/) over markdown, rendering LaTeX, templating without needless allocations, and more. ::: # The realm's secrets diff --git a/flake.nix b/flake.nix index f327a56..63a77a9 100644 --- a/flake.nix +++ b/flake.nix @@ -38,7 +38,6 @@ buildInputs = with pkgs; [ ]; - MOONYTHM_DRAFTS = 1; LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; }; }; diff --git a/justfile b/justfile index faae106..1585c5e 100644 --- a/justfile +++ b/justfile @@ -7,6 +7,16 @@ minify-sitemap: serve-dev: http-server dist +# {{{ Building +build: + cargo run + +build-dev: + MOONYTHM_DRAFTS=1 cargo run + +update-modification-dates: + MOONYTHM_UPDATE_LAST_MODIFIED=1 cargo run +# }}} # {{{ Linting lint: lint-vnu lint-css lint-htmltest lint-htmlvalidate diff --git a/last_modified.toml b/last_modified.toml index d8840ed..fabb10d 100644 --- a/last_modified.toml +++ b/last_modified.toml @@ -1 +1 @@ -pages = [["Posts", "2024-11-07T08:50:05+01:00"], [{ Post = "arcaea-pookies" }, "2025-03-03T22:34:06+01:00"], [{ Post = "the-realm-s-secrets" }, "2025-03-03T22:34:06+01:00"], [{ Post = "arcaea" }, "2025-03-03T22:34:06+01:00"], [{ Post = "yugioh-my-beloved" }, "2024-11-06T08:34:21+01:00"], [{ Post = "games" }, "2025-03-03T22:34:06+01:00"], ["NotFound", "2025-03-03T22:34:06+01:00"], ["Home", "2025-03-03T22:34:06+01:00"]] +pages = [["Posts", "2024-11-07T08:50:05+01:00"], [{ Post = "arcaea-pookies" }, "2025-03-03T22:34:06+01:00"], [{ Post = "the-realm-s-secrets" }, "2025-03-04T00:05:02+01:00"], [{ Post = "arcaea" }, "2025-03-03T22:34:06+01:00"], [{ Post = "yugioh-my-beloved" }, "2024-11-06T08:34:21+01:00"], [{ Post = "games" }, "2025-03-03T22:34:06+01:00"], ["NotFound", "2025-03-03T22:34:06+01:00"], ["Home", "2025-03-03T22:34:06+01:00"]] diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..cf81738 Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/generate.rs b/src/generate.rs index 9d8e39c..7d15808 100644 --- a/src/generate.rs +++ b/src/generate.rs @@ -54,7 +54,12 @@ impl<'a> Pages<'a> { let metadata = PageMetadata::new(&mut self.last_modified_cache, content_path, source, events)?; - self.pages.push(metadata); + if std::env::var("MOONYTHM_DRAFTS").unwrap_or_default() == "1" + || metadata.config.created_at.is_some() + || !matches!(metadata.route, crate::metadata::PageRoute::Post(_)) + { + self.pages.push(metadata); + } Ok(()) } diff --git a/src/html.rs b/src/html.rs index ae0fa91..be8befb 100644 --- a/src/html.rs +++ b/src/html.rs @@ -287,13 +287,6 @@ impl<'s> Writer<'s> { continue; } - // Skip drafts - if std::env::var("MOONYTHM_DRAFTS").unwrap_or_default() != "1" - && post.config.created_at.is_none() - { - continue; - } - template!("templates/post-summary.html", out)?.feed( out, |label, out| { @@ -366,29 +359,30 @@ impl<'s> Writer<'s> { continue; } - write!(out, r##"<li><a href="#{}">"##, heading.id)?; + writeln!(out, r##"<li><a href="#{}">"##, heading.id)?; for event in &heading.events { self.render_event(event, out)?; } // We only close the <a> here, as we might want to include a // sublist inside the same <li> element. - write!(out, "</a>")?; + writeln!(out, "</a>")?; let next_level = self.metadata.toc.get(i + 1).map_or(2, |h| h.level); match heading.level.cmp(&next_level) { Ordering::Equal => { - write!(out, "</li>")?; + writeln!(out, "</li>")?; } Ordering::Less => { - write!(out, "<ol>")?; + writeln!(out, "<ol>")?; level_stack.push(next_level); } Ordering::Greater => { + writeln!(out, "</li>")?; while level_stack.last().unwrap() > &next_level { - write!(out, "</ol></li>")?; + writeln!(out, "</ol></li>")?; level_stack.pop(); } } @@ -726,6 +720,7 @@ impl<'s> Writer<'s> { date.format("%a, %d %b %Y") )?; } else if matches!(self.states.last(), Some(State::Strikethrough)) { + self.states.pop(); out.write_str("</s>")?; } else { out.write_str("</span>")?; diff --git a/src/templates/page.html b/src/templates/page.html index 7651cfa..66fc129 100644 --- a/src/templates/page.html +++ b/src/templates/page.html @@ -6,9 +6,7 @@ name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> - <meta name="theme-color" content="#000000" /> - <title>Moonythm</title> - + <meta name="theme-color" content="#faebff" /> <link rel="stylesheet" href="/styles.css" /> <!-- MathML --> @@ -25,6 +23,8 @@ /> <!-- Meta --> + <title>Moonythm | {{title}}</title> + <link rel="icon" type="image/x-icon" href="/favicon.ico"> <meta property="og:site_name" content="Moonythm" /> <meta property="og:title" content="{{title}}" /> <meta property="twitter:title" content="{{title}}" /> diff --git a/src/templates/post.html b/src/templates/post.html index 4e75cf4..5760f9e 100644 --- a/src/templates/post.html +++ b/src/templates/post.html @@ -4,7 +4,7 @@ <ul> <li> - {{posted_on}} by <a href="base_url">prescientmoon</a> + {{posted_on}} by <a href="{{base_url}}">prescientmoon</a> </li> <li> Last updated on {{updated_on}}. <a href="{{source_url}}">Source</a> | diff --git a/tooling/htmlvalidate.json b/tooling/htmlvalidate.json index aecff00..e4d10c8 100644 --- a/tooling/htmlvalidate.json +++ b/tooling/htmlvalidate.json @@ -5,5 +5,9 @@ "html-validate:a11y", "html-validate:document", "html-validate:prettier" - ] + ], + "rules": { + "require-sri": "off", + "heading-level": "off" + } }