rss: lobsters suggestions, link in footer

Signed-off-by: Naman Sood <naman.sood@data.world>
This commit is contained in:
Naman Sood 2022-06-28 11:09:33 -05:00
parent 323fe7010f
commit 47638c8662
6 changed files with 39 additions and 22 deletions

View file

@ -68,3 +68,5 @@ Maybe I should write tests for this. hmm...
It finally happened -- I wrote a bunch of "clever" Go code last year to make this blog and now it's hard for me to grok what I've written. It's not _too_ bad though -- I was able to get RSS to work, after all! -- but I think it's a sign that I need to refactor a lot of this code to be simpler. I don't want to abandon the all-text-files-load-from-memory thing _yet,_ we'll see if I can tame the complexity beast enough while still keeping that one thing I think is cool.
Gonna `git commit -as && git push` this now, and start refreshing the RSS reader. Fingers crossed!
**Update (June 28, 2022, 11:58AM):** Following some really helpful suggestions on this [lobste.rs](https://lobste.rs/s/lrnqsv/implementing_rss_for_my_blog_yes_this_one) thread, I made some changes to my feed and blog HTML for better compatibility and discoverability. If you're following this, highly recommend following the suggestions listed there -- like running your feed through the [W3C validator](https://validator.w3.org/feed/) or adding a `<link>` tag corresponding to your RSS feed in the HTML. Thanks to snej and carlmjohnson for the suggestions! Also, the feed works, test passed. :)

View file

@ -253,7 +253,7 @@ func (s *server) loadStylesheet(res http.ResponseWriter, req *http.Request, file
}
func rssDatetime(timestamp int64) string {
return time.Unix(timestamp, 0).Format("Mon, 02 Jan 06 15:04:05 MST")
return time.Unix(timestamp, 0).Format("Mon, 02 Jan 2006 15:04:05 MST")
}
func createImage(title, summary, url string, out io.Writer) error {

View file

@ -30,6 +30,26 @@ $accentColorDark: #3498db;
--accentColor: #{$accentColorLight};
}
@mixin link {
color: var(--strongColor);
text-decoration: none;
background-image: linear-gradient(
transparent 80%,
var(--faintFadeColor) 80%,
var(--faintFadeColor) 87.5%,
transparent 87.5%
);
&:hover {
background-image: linear-gradient(
transparent 80%,
var(--faintBodyColor) 80%,
var(--faintBodyColor) 87.5%,
transparent 87.5%
);
}
}
::selection {
background-color: var(--accentColor);
}
@ -259,23 +279,7 @@ article {
section.content {
a {
color: var(--strongColor);
text-decoration: none;
background-image: linear-gradient(
transparent 80%,
var(--faintFadeColor) 80%,
var(--faintFadeColor) 87.5%,
transparent 87.5%
);
&:hover {
background-image: linear-gradient(
transparent 80%,
var(--faintBodyColor) 80%,
var(--faintBodyColor) 87.5%,
transparent 87.5%
);
}
@include link;
}
ul, ol {
@ -331,7 +335,14 @@ article {
footer {
text-align: center;
padding: $ls 0;
padding: 0;
p {
margin: $ls 0;
a {
@include link;
}
}
}
@media (prefers-color-scheme: dark) {

View file

@ -13,6 +13,7 @@
<meta name="twitter:card" content="summary_large_image">
<meta name="color-scheme" content="dark light">
<meta name="viewport" content="width=device-width">
<link rel="alternate" type="application/rss+xml" href="https://prose.nsood.in/rss.xml">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/css/nunito.css">
<link rel="stylesheet" href="/css/jetbrainsmono.css">
@ -32,7 +33,8 @@
{{{contents}}}
</main>
<footer>
Made by Naman Sood, with love.
<p>Made by Naman Sood, with love.</p>
<p><a href="/rss.xml">RSS</a></p>
</footer>
</body>
</html>

View file

@ -1,10 +1,11 @@
<rss version="2.0">
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{title}}</title>
<link>{{link}}</link>
<description>{{description}}</description>
<language>en-US</language>
<pubDate>{{pubDate}}</pubDate>
<atom:link href="https://prose.nsood.in/rss.xml" rel="self" type="application/rss+xml" />
{{{items}}}
</channel>
</rss>

View file

@ -1,7 +1,8 @@
<item>
<title>{{metadata.title}}</title>
<link>{{getFullUrl slug}}</link>
<guid>{{slug}}</guid>
<description>{{metadata.summary}}</description>
<author>mail@nsood.in</author>
<author>mail@nsood.in (Naman Sood)</author>
<pubDate>{{rssDatetime metadata.time}}</pubDate>
</item>