add rss feed
This commit is contained in:
parent
5f954a80f5
commit
79b5e06aca
11 changed files with 1079 additions and 1086 deletions
55
assets/rss.xsl
Normal file
55
assets/rss.xsl
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" />
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: "Inter",sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 300;
|
||||
color: hsl(217 17% 21%);
|
||||
max-width: 1024px;
|
||||
margin: 20px auto;
|
||||
padding: 15px;
|
||||
}
|
||||
img {
|
||||
float: right;
|
||||
height: 40px;
|
||||
margin: 12px 0;
|
||||
}
|
||||
a {
|
||||
color: #4a66b9;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:value-of select="//channel/image/url" />
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
<h1>
|
||||
<xsl:value-of select="//channel/title" />
|
||||
</h1>
|
||||
<hr />
|
||||
<xsl:apply-templates select="//item" />
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<content-item>
|
||||
<h2>
|
||||
<a href="{link}">
|
||||
<xsl:value-of select="title" />
|
||||
</a>
|
||||
</h2>
|
||||
<p>
|
||||
<xsl:value-of select="description" />
|
||||
</p>
|
||||
</content-item>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
75
assets/simple-atom.xslt
Normal file
75
assets/simple-atom.xslt
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="3.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="referrer" content="unsafe-url" />
|
||||
<title><xsl:value-of select="/atom:feed/atom:title"/></title>
|
||||
<link rel="stylesheet" href="https://www.rss.style/css/water.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
<img alt="feed icon" src="https://www.vectorlogo.zone/logos/rss/rss-tile.svg" style="height:1em;vertical-align:middle;" /> 
|
||||
<xsl:value-of select="/atom:feed/atom:title"/>
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
<xsl:value-of select="/atom:feed/atom:subtitle"/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This is the Atom <a href="https://www.rss.style/what-is-a-feed.html">news feed</a> for the 
|
||||
<a><xsl:attribute name="href">
|
||||
<xsl:value-of select="/atom:feed/atom:link[@rel='alternate']/@href | /atom:feed/atom:link[not(@rel)]/@href"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="/atom:feed/atom:title"/></a> 
|
||||
website.
|
||||
</p>
|
||||
|
||||
<p>It is meant for <a href="https://www.rss.style/newsreaders.html">news readers</a>, not humans. Please copy-and-paste the URL into your news reader!</p>
|
||||
|
||||
<p>
|
||||
<pre>
|
||||
<code id="feedurl"><xsl:value-of select="/atom:feed/atom:link[@rel='self']/@href"/></code>
|
||||
</pre>
|
||||
<button
|
||||
class="clipboard"
|
||||
data-clipboard-target="#feedurl">
|
||||
Copy to clipboard
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<xsl:for-each select="/atom:feed/atom:entry">
|
||||
<details><summary>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="atom:id"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="atom:title"/>
|
||||
</a> - 
|
||||
<xsl:value-of select="atom:updated" />
|
||||
</summary>
|
||||
<xsl:choose>
|
||||
<xsl:when test="atom:content">
|
||||
<xsl:value-of disable-output-escaping="yes" select="atom:content" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="atom:summary" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</details>
|
||||
</xsl:for-each>
|
||||
<p><xsl:value-of select="count(/atom:feed/atom:entry)"/> news items.</p>
|
||||
<p><small>Powered by <a href="https://www.rss.style/"><img referrerpolicy="origin" src="https://www.rss.style/favicon.svg" style="height:1em;padding-right:0.25em;vertical-align:middle;" />RSS.Style</a></small></p>
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
||||
<script>
|
||||
new ClipboardJS('.clipboard');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
Loading…
Add table
Add a link
Reference in a new issue