Skip to content

Commit

Permalink
Style RSS feed
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaggioni committed Jun 22, 2023
1 parent bcf0d7f commit 8bf5393
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 4 deletions.
6 changes: 2 additions & 4 deletions feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sitemap:
exclude: 'yes'
---
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/feed.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.title | xml_escape }}</title>
Expand All @@ -16,13 +17,10 @@ sitemap:
{% for post in site.posts limit:10 %}
<item>
<title>{{ post.title | xml_escape }}</title>
<description>{{ post.content | xml_escape }}</description>
<description>{% if post.subtitle %}{{ post.subtitle | xml_escape }}{% else %}{{ post.head_message | xml_escape }}{% endif %}</description>
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
<link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>
<guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>
{% for tag in post.tags %}
<category>{{ tag | xml_escape }}</category>
{% endfor %}
{% for cat in post.categories %}
<category>{{ cat | xml_escape }}</category>
{% endfor %}
Expand Down
55 changes: 55 additions & 0 deletions feed.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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 xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>
<xsl:value-of select="/rss/channel/title"/> | RSS Feed
</title>
<link rel="stylesheet" href="/css/main.css"/>
</head>
<body>
<div class="wrapper" style="padding-top: 32px">
<h1 class="page-title" style="margin: revert">
<img src="/assets/img/logo.png" alt="born2scan logo" width="125" class="team-logo" style="margin-top: revert"/>
<div class="page-title__text">
Most recent posts
</div>
<div class="page-title__subtitle" style="margin-top: 1em">
This is a styled RSS feed. Visit
<a href="https://aboutfeeds.com">About Feeds</a>
to learn more and get started. It’s free.
</div>
</h1>
<div class="grid-center" style="margin-top: 1em">
<div>
<ul>
<xsl:for-each select="/rss/channel/item">
<li style="margin-bottom: 1em;">
<div>
<a><xsl:attribute name="href"><xsl:value-of select="link/@href"/></xsl:attribute><xsl:value-of select="title"/></a>
</div>
<div>
<b>Published at: </b> <xsl:value-of select="substring(pubDate, 0, 17)"/>
</div>
<div>
<b>Category: </b> <xsl:value-of select="category"/>
</div>
<div>
<b>Description: </b> <xsl:value-of select="description"/>
</div>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

<!-- https://darekkay.com/blog/rss-styling/ -->

0 comments on commit 8bf5393

Please sign in to comment.