Use XSL to style RSS feed (thanks @iacore!)
This commit is contained in:
parent
b3d234a0b0
commit
2534413a9f
35
public/rss.xsl
Normal file
35
public/rss.xsl
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="3.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
||||
<head>
|
||||
<title>
|
||||
RSS Feed | <xsl:value-of select="//title"/>
|
||||
</title>
|
||||
<!-- where is the stylesheet? -->
|
||||
<!-- <link rel="stylesheet" href="/assets/styles.css"/> -->
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
This is an RSS feed. Visit
|
||||
<a href="https://aboutfeeds.com">About Feeds</a>
|
||||
to learn more and get started.
|
||||
</p>
|
||||
<h1>RSS Feed | <xsl:value-of select="//title"/></h1>
|
||||
<xsl:for-each select="//item">
|
||||
<article>
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="link"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="title"/>
|
||||
</a>
|
||||
</article>
|
||||
</xsl:for-each>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -18,5 +18,6 @@ export async function GET(context: { site: any; }) {
|
|||
content: sanitizeHtml(parser.render(post.body)),
|
||||
link: `/posts/${post.slug}`,
|
||||
})) as RSSFeedItem[],
|
||||
stylesheet: '/rss.xsl',
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue