-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeed.xsl
179 lines (164 loc) · 5.72 KB
/
feed.xsl
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom"
exclude-result-prefixes="atom"
>
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<title>RSS Feed - <xsl:value-of select="atom:feed/atom:title"/></title>
<style type="text/css">
body {
max-width: 768px;
margin: 0 auto;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 1.1rem;
line-height: 1.5em;
}
section {
margin: 30px 15px;
}
section:last-child {
max-width: 600px;
margin-left: auto;
margin-right: auto;
margin-bottom: 60px;
counter-reset: postCounter;
}
h1 {
font-size: 2em;
margin: .67em 0;
line-height: 1.125em;
}
h2 {
border-bottom: 1px solid #000;
padding-bottom: .3em;
}
.alert {
background: #fff5b1;
padding: 4px 12px;
margin: 0 -12px;
}
a {
text-decoration: none;
color: #000;
}
a:hover {
text-decoration: underline;
}
.entry {
border-bottom: solid 1px #000;
counter-increment: postCounter;
padding-bottom: 1rem;
}
.entry h3 {
font-size: 1.1rem;
margin-bottom: 0;
font-weight: 600;
text-transform: uppercase;
}
.entry p {
color: #555;
margin: 4px 0;
}
.entry img {
clip-path: circle(45%);
height: auto;
float: right;
width: 100px;
}
.entry::after {
display: block;
clear: both;
content: "";
}
.counter {
color: #fff;
padding: 4px;
font-weight: 400;
background-color: #0f3b63;
border-radius: 50%;
border: solid 1px #000;
margin-right: .5rem;
}
.entry:hover .counter {
background-color: #fff;
color: #c61f48;
border-color: #c61f48;
}
.counter::after {
font-size: 12px;
vertical-align: top;
width: 20px;
height: 20px;
text-align: center;
content: counter(postCounter);
visibility: visible;
display: inline-block;
}
</style>
</head>
<body>
<section>
<div class="alert">
<p><strong>This is a web feed</strong>, also known as an RSS feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader app.</p>
</div>
</section>
<section>
<xsl:apply-templates select="atom:feed" />
</section>
<section>
<h2>Recent Items</h2>
<xsl:apply-templates select="atom:feed/atom:entry" />
</section>
</body>
</html>
</xsl:template>
<xsl:template match="atom:feed">
<h1><xsl:value-of select="atom:title"/> - RSS Feed</h1>
<p>This RSS feed provides the latest news posts from the <xsl:value-of select="atom:title"/>.
<a class="head_link" target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="atom:link[@rel='alternate']/@href"/>
</xsl:attribute>
Visit Website →
</a>
</p>
<h2>What is an RSS feed?</h2>
<p>An RSS feed is a data format that contains the latest content from a website, blog, or podcast. You can use feeds to <strong>subscribe</strong> to websites and get the <strong>latest content in one place</strong>.</p>
<ul>
<li><strong>Feeds put you in control.</strong> 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.</li>
<li><strong>Feed are private by design.</strong> No one owns web feeds, so no one is harvesting your personal information and profiting by selling it to advertisers.</li>
<li><strong>Feeds are spam-proof.</strong> Had enough? Easy, just unsubscribe from the feed.</li>
</ul>
<p>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 <a href="https://aboutfeeds.com/">About Feeds</a> to get started with newsreaders and subscribing. It's free. </p>
</xsl:template>
<xsl:template match="atom:entry">
<div class="entry">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="atom:thumbnail"/>
</xsl:attribute>
</xsl:element>
<h3>
<span class="counter"></span>
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
<xsl:value-of select="atom:title"/>
</a>
</h3>
<p>
<xsl:value-of select="atom:summary" disable-output-escaping="yes" />
</p>
<small>
Published: <xsl:value-of select="atom:updated" />
</small>
</div>
</xsl:template>
</xsl:stylesheet>