From f7d67da481c8523a2cb09df057b5d17de459cd37 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sun, 22 Feb 2026 10:04:07 +1300 Subject: Support linking to generated feeds The has_static routine that checks whether links to static files are valid now correctly considers generated feeds as static files. --- src/collect_files.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/collect_files.rs b/src/collect_files.rs index 3616c8a..d6d7cc2 100644 --- a/src/collect_files.rs +++ b/src/collect_files.rs @@ -453,8 +453,8 @@ impl Website { return None; } - /// Check if the external link `path` points to a valid static file. - /// Returns a resolved absolute link to the file. + /// Check if the external link `path` points to a valid static file or + /// generated feed. Returns a resolved absolute link to the file. pub fn has_static(&self, from: &impl LinkFrom, path: &str) -> Option { // Attach parent if not an absolute path. // We don't want to canonicalise/sluggify the path. @@ -462,9 +462,14 @@ impl Website { true => collapse_path(&format!("{}{path}", from.parent_url())), false => collapse_path(path), }; + let root = from.root(); for file in &self.static_files { if file.url == path { - let root = from.root(); + return Some(format!("{root}{path}")); + } + } + for feed in &self.feeds { + if format!("{}.rss", feed.url) == path { return Some(format!("{root}{path}")); } } -- cgit v1.2.3-70-g09d2