1
1
import fs from 'fs'
2
- import path from 'path'
3
2
import ReactDOMServer from 'react-dom/server'
4
3
import { MDXProvider } from '@mdx-js/react'
5
4
import { Feed } from 'feed'
@@ -10,22 +9,21 @@ import { getAllPosts } from '../src/getAllPostPreviews'
10
9
const siteUrl = 'https://blog.tailwindcss.com'
11
10
12
11
const feed = new Feed ( {
13
- title : 'Blog – Tailwind CSS' ,
12
+ title : 'Tailwind CSS Blog ' ,
14
13
description : 'All the latest Tailwind CSS news, straight from the team.' ,
15
14
id : siteUrl ,
16
15
link : siteUrl ,
17
16
language : 'en' ,
18
17
image : `${ siteUrl } /favicon-32x32.png` ,
19
18
favicon : `${ siteUrl } /favicon.ico` ,
20
- copyright : ' All rights reserved 2020 , Tailwind Labs' ,
19
+ copyright : ` All rights reserved ${ new Date ( ) . getFullYear ( ) } , Tailwind Labs` ,
21
20
feedLinks : {
22
21
rss : `${ siteUrl } /feed.xml` ,
23
22
json : `${ siteUrl } /feed.json` ,
24
23
atom : `${ siteUrl } /atom.xml` ,
25
24
} ,
26
25
author : {
27
26
name : 'Adam Wathan' ,
28
- email : 'adam.wathan@gmail.com' ,
29
27
link : 'https://twitter.com/@adamwathan' ,
30
28
} ,
31
29
} )
@@ -37,14 +35,13 @@ getAllPosts().forEach(({ link, module: { meta, default: Content } }) => {
37
35
</ MDXProvider >
38
36
)
39
37
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 >`
43
41
feed . addItem ( {
44
42
title : meta . title ,
45
43
id : meta . title ,
46
44
link,
47
- comments : meta . discussion ,
48
45
description : meta . description ,
49
46
content : html + postText ,
50
47
author : meta . authors . map ( ( { name, twitter } ) => ( {
@@ -53,15 +50,20 @@ getAllPosts().forEach(({ link, module: { meta, default: Content } }) => {
53
50
} ) ) ,
54
51
date : new Date ( meta . date ) ,
55
52
image : siteUrl + meta . image ,
56
- extensions : [
57
- {
58
- name : '_comments' ,
59
- objects : {
60
- about : 'link to discussions forum' ,
53
+ ...( meta . discussion
54
+ ? {
61
55
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
+ : { } ) ,
65
67
} )
66
68
} )
67
69
0 commit comments