eratic / sites / io / public / rss.xsl
276 words
 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?xml version="1.0" encoding="UTF-8"?>
<!--
	Makes the raw feed legible when someone clicks the RSS link in a browser
	instead of pasting it into a reader. Without this they get a wall of XML or
	a download prompt, and conclude the feed is broken.

	Browsers apply this stylesheet locally. Nothing is fetched from anywhere.
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
	<xsl:template match="/">
		<html lang="en">
			<head>
				<meta charset="utf-8" />
				<meta name="viewport" content="width=device-width, initial-scale=1" />
				<title><xsl:value-of select="/rss/channel/title" /> feed</title>
				<style>
					:root { color-scheme: light dark; }
					body {
						font: 16px/1.6 ui-sans-serif, system-ui, sans-serif;
						max-width: 42rem;
						margin: 0 auto;
						padding: 3rem 1.25rem;
						background: light-dark(#faf9f7, #141619);
						color: light-dark(#33373c, #e8e6e1);
					}
					h1 { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 0.25rem; }
					a { color: light-dark(#2b5cb8, #8fb3f0); }
					.note {
						background: light-dark(#fff, #1c1f24);
						border: 1px solid light-dark(#e2e0da, #2f3339);
						border-radius: 3px;
						padding: 0.85rem 1rem;
						margin: 1.5rem 0 2.5rem;
						font-size: 0.9rem;
					}
					.muted { color: light-dark(#6b7078, #9aa0a8); font-size: 0.875rem; }
					article { padding: 1.25rem 0; border-top: 1px solid light-dark(#e2e0da, #2f3339); }
					article h2 { font-size: 1.1rem; margin: 0 0 0.2rem; }
					article h2 a { text-decoration: none; }
					article h2 a:hover { text-decoration: underline; }
					p { margin: 0.35rem 0 0; }
				</style>
			</head>
			<body>
				<h1><xsl:value-of select="/rss/channel/title" /></h1>
				<p class="muted"><xsl:value-of select="/rss/channel/description" /></p>

				<div class="note">
					<strong>This is a feed.</strong> Copy the address from your
					browser's address bar into a feed reader (NetNewsWire, Reeder,
					Feedbin, Inoreader) and new posts will arrive there
					automatically. No account, no email, no tracking.
				</div>

				<xsl:for-each select="/rss/channel/item">
					<article>
						<h2>
							<a href="{link}"><xsl:value-of select="title" /></a>
						</h2>
						<p class="muted"><xsl:value-of select="pubDate" /></p>
						<p><xsl:value-of select="description" /></p>
					</article>
				</xsl:for-each>

				<p class="muted" style="margin-top:2.5rem">
					<a href="{/rss/channel/link}">← Back to the site</a>
				</p>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

static mirror of HEAD · about · clone: git clone https://git.makefuture.ro/eratic.git