Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog: add RSS feed #299

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/rss": "^4.0.10",
"@octokit/rest": "^21.0.2",
"@sanity/astro": "^3.1.6",
"@sanity/client": "^6.24.1",
Expand Down
60 changes: 60 additions & 0 deletions public/rss.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
// © 2024 Functional Software, Inc. dba Sentry
// SPDX-License-Identifier: Apache-2.0
-->
<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>
RSS Feed | <xsl:value-of select="/rss/channel/title"/>
</title>
<link rel="stylesheet" href="/common.css"/>
</head>
<body>
<main class="container">
<div class="highlight-box">
<strong>This is an RSS feed.</strong>
Subscribe by copying the URL from the address bar into your newsreader.
Visit <a href="https://aboutfeeds.com">About Feeds</a> to learn more.
</div>
<section>
<div class="text-center">
<h1><xsl:value-of select="/rss/channel/title"/></h1>
</div>
<div>
<xsl:for-each select="/rss/channel/item">
<div class="article-listing">
<blockquote>
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<h2><xsl:value-of select="title"/></h2>
</a>
</blockquote>
<div class="meta">
<div>
<em>
<xsl:value-of select="author"/>
</em>
<time>
<xsl:value-of select="substring(pubDate, 6, 11)"/>
</time>
</div>
</div>
<hr/>
</div>
</xsl:for-each>
</div>
</section>
</main>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
45 changes: 3 additions & 42 deletions src/components/ArticleList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -43,45 +43,6 @@ const articles = (await sanityClient.fetch<SanityDocument[]>(ARTICLES_QUERY))
</div>)}
</div>

<style>
.article-listing {
position: relative;
margin: 0;
hr {
margin: 1.5rem auto;
max-width: 10rem;
border-color: var(--color-primary);
border-width: 1px;
}
&:last-child hr {
display: none;
}
h2 {
font-size: 1.2rem;
font-weight: normal;
font-family: Libre Franklin, sans-serif;
}
blockquote {
margin: 0;
}
.meta {
display: flex;
align-items: center;
.avatar {
width: 2.5rem;
height: 2.5rem;
background-size: cover;
background-position: center center;
margin-right: 1rem;
border-radius: 100%;
}
em {
display: block;
}
time {
display: block;
font-size: 0.8rem;
}
}
}
</style>
<!--
Styles are in `common.css`, because they are reused in `rss.xsl`.
-->
Loading
Loading