Skip to content
This repository was archived by the owner on Feb 14, 2022. It is now read-only.

Commit cde73d4

Browse files
committed
minor changes to rss feed
1 parent c5135ba commit cde73d4

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

scripts/build-rss.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import fs from 'fs'
2-
import path from 'path'
32
import ReactDOMServer from 'react-dom/server'
43
import { MDXProvider } from '@mdx-js/react'
54
import { Feed } from 'feed'
@@ -10,22 +9,21 @@ import { getAllPosts } from '../src/getAllPostPreviews'
109
const siteUrl = 'https://blog.tailwindcss.com'
1110

1211
const feed = new Feed({
13-
title: 'Blog – Tailwind CSS',
12+
title: 'Tailwind CSS Blog',
1413
description: 'All the latest Tailwind CSS news, straight from the team.',
1514
id: siteUrl,
1615
link: siteUrl,
1716
language: 'en',
1817
image: `${siteUrl}/favicon-32x32.png`,
1918
favicon: `${siteUrl}/favicon.ico`,
20-
copyright: 'All rights reserved 2020, Tailwind Labs',
19+
copyright: `All rights reserved ${new Date().getFullYear()}, Tailwind Labs`,
2120
feedLinks: {
2221
rss: `${siteUrl}/feed.xml`,
2322
json: `${siteUrl}/feed.json`,
2423
atom: `${siteUrl}/atom.xml`,
2524
},
2625
author: {
2726
name: 'Adam Wathan',
28-
email: 'adam.wathan@gmail.com',
2927
link: 'https://twitter.com/@adamwathan',
3028
},
3129
})
@@ -37,14 +35,13 @@ getAllPosts().forEach(({ link, module: { meta, default: Content } }) => {
3735
</MDXProvider>
3836
)
3937
const html = ReactDOMServer.renderToStaticMarkup(mdx)
40-
const postText = `<div style="margin-top=55px; font-style: italic;">(The post <a href="${
41-
siteUrl + link
42-
}">${meta.title}</a> appeared first on <a href="${siteUrl}">Tailwind CSS Blog</a>.)</div>`
38+
const postText = `<p><em>(The post <a href="${siteUrl + link}">${
39+
meta.title
40+
}</a> appeared first on <a href="${siteUrl}">Tailwind CSS Blog</a>.)</em></p>`
4341
feed.addItem({
4442
title: meta.title,
4543
id: meta.title,
4644
link,
47-
comments: meta.discussion,
4845
description: meta.description,
4946
content: html + postText,
5047
author: meta.authors.map(({ name, twitter }) => ({
@@ -53,15 +50,20 @@ getAllPosts().forEach(({ link, module: { meta, default: Content } }) => {
5350
})),
5451
date: new Date(meta.date),
5552
image: siteUrl + meta.image,
56-
extensions: [
57-
{
58-
name: '_comments',
59-
objects: {
60-
about: 'link to discussions forum',
53+
...(meta.discussion
54+
? {
6155
comments: meta.discussion,
62-
},
63-
},
64-
],
56+
extensions: [
57+
{
58+
name: '_comments',
59+
objects: {
60+
about: 'Link to discussion forum',
61+
comments: meta.discussion,
62+
},
63+
},
64+
],
65+
}
66+
: {}),
6567
})
6668
})
6769

0 commit comments

Comments
 (0)