1
0
Fork 0
isopod.cool/blog/comment/feed.php
will 1038b3c577 Markdown moment
- Added Markdown support to guestbook and blog comments
- Moved comment rendering code to post rendering script
- Markdownized final remaining blog post
- Fixed one page that was still designed for the old code block css
2024-09-10 21:04:29 -06:00

29 lines
No EOL
1.2 KiB
PHP

<?php
include("../../Parsedown.php");
$Parsedown = new Parsedown();
$Parsedown->setSafeMode(true);
header('Content-Type: text/xml');
echo '<rss version="2.0"><channel>';
echo '<title>isopod.cool blog comments</title>';
echo '<description>Every comment posted on my blog in chronological order.</description>';
echo '<language>en-us</language>';
echo '<link>https://isopod.cool/blog/comment/</link>';
echo '<generator>My crappy PHP code</generator>';
$postlist = json_decode(file_get_contents("posts.json"));
$totaloutput = "";
foreach($postlist as $post) {
$output = "";
$date = date("D, d M Y H:m:s", $post->date) . " GMT";
$name = $post->name;
$message = $Parsedown->text(html_entity_decode($post->message));
$entry = $post->entry;
$output = $output."Comment from ".$name." on ".$entry.":<br><br>".$message."<br><br>";
$totaloutput = "<item><title>Comment on " . $entry . " from " . $name . "</title><link>https://isopod.cool/blog/posts/" . $entry . "/</link><pubDate>" . $date . "</pubDate><description>".htmlentities($output)."</description><guid isPermaLink='false'>" . $entry . $post->date . $name . "</guid></item>".$totaloutput;
}
echo $totaloutput;
echo "</channel></rss>";