diff --git a/resources/feed.xsl b/resources/feed.xsl new file mode 100644 index 0000000..7b47381 --- /dev/null +++ b/resources/feed.xsl @@ -0,0 +1,77 @@ + + + + + + + + Web Feed • <xsl:value-of select="atom:feed/atom:title"/> + + + +
+
+

This is a web feed, also known as an RSS feed. Subscribe by copying the URL from the address bar into your newsreader app.

+
+
+
+ +
+
+

Recent Items

+ +
+ + +
+ + +

's Web Feed Preview

+

This RSS feed provides the latest posts from 's blog. + + + + + + Visit Website → + + +

+ +

What is an RSS feed?

+

An RSS feed is a data format that contains the latest content from a website, blog, or podcast. You can use feeds to subscribe to websites and get the latest content in one place.

+
    +
  • Feeds put you in control. Unlike social media apps, there is no algorithm deciding what you see or read. You always get the latest content from the creators you care about.
  • +
  • Feed are private by design. No one owns web feeds, so no one is harvesting your personal information and profiting by selling it to advertisers.
  • +
  • Feeds are spam-proof. Had enough? Easy, just unsubscribe from the feed.
  • +
+

All you need to do to get started is to add the URL (web address) for this feed to a special app called a newsreader. Visit About Feeds to get started with newsreaders and subscribing. It’s free.

+
+ + +
+

+ + + + + + +

+

+ +

+ + Published: + +
+
+ +
\ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 2d26442..fa66cbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ use std::{ pub(crate) use message::Message; const INDEX_HTML: & 'static str = include_str!("../resources/index.html"); +const FEED_STYLESHEET: & 'static str = include_str!("../resources/feed.xsl"); fn main() -> Result<(), Box> { let cli = cli::Cli::parse(); @@ -101,17 +102,22 @@ fn build_feed(filename: &PathBuf, hostname: String, include_html: bool) -> Resul write_file(&path, processed_html.as_bytes())?; } - // Ugly hack, but I don't know how to do this better... - let file_name = format!("{:?}", filename.file_name().unwrap()).replace('"', ""); - write_file(dir.join("index.html"), INDEX_HTML.replace("{FEED}", file_name.as_str()))?; - feed::add_entry_to_feed(&mut feed, &msg, &processed_html, &hostname, include_html); } if feed.entries.len() > 0 { feed.set_updated(Utc::now()); println!("Writing feed to {}", filename.display()); - let _ = feed.write_to(File::create(filename).unwrap()); + + // TODO: Ugly hack because atom_syndication crate does not support style sheets. + let feed_str = feed.to_string().as_str().replace(">\n\n\n