summaryrefslogtreecommitdiff
path: root/feed.php
blob: 61dd19c570552c586c31ff4ce97a8a03dc101eb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php header('content-type: application/rss+xml'); ?>

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>53hornet's Feed</title>
		<link>https://www.53hor.net</link>
		<atom:link href="https://www.53hor.net/rss.xml" rel="self" type="application/rss+xml" />
		<description>The World Wide Web pages of Adam Carpenter</description>
		<image>
			<url>https://www.53hor.net/assets/53hornet.svg</url>
			<title>53hornet's Feed</title>
			<link>https://www.53hor.net</link>
		</image>
		<?php
		$posts = scandir('./posts', SCANDIR_SORT_DESCENDING);
		$posts = array_filter($posts, fn ($post) => !empty($post) && $post != '.' && $post != '..');

		foreach ($posts as &$post) {
			$title = str_replace('<h1>', '', fgets(fopen("./posts/$post", 'r')));
			$title = str_replace('</h1>', '', $title);
			$post = str_replace('.php', '', $post);
			printf('<item><link>https://www.53hor.net/%s</link><title>%s</title></item>', $post, $title);
		}
		?>
	</channel>
</rss>