rss: add author field to v2ex (#229)

* rss: add author field to v2ex

* rss: add username to v2ex description

* rss: v2ex use content_rendered to description
This commit is contained in:
Liu 2018-06-02 11:03:15 +08:00 committed by DIYgod
parent 1428399d27
commit 12a7390e38
3 changed files with 7 additions and 3 deletions

View File

@ -27,12 +27,13 @@ module.exports = async (ctx) => {
description: `V2EX-${title}`,
item: data.map((item) => ({
title: item.title,
description: item.content,
description: `${item.member.username}: ${item.content_rendered}`,
content: item.content,
content_rendered: item.content_rendered,
pubDate: new Date(item.created * 1000).toUTCString(),
guid: item.id,
link: item.url,
author: item.member.username,
})),
};
};

View File

@ -11,6 +11,9 @@
{
"id": "{{ $value.guid || $value.link }}",
"url": "{{ $value.link }}",
"author": {
"name": "{{ $value.author }}",
},
"external_url": "",
"title": "{{ $value.title }}",
"content_html": "{{ $value.content_rendered }}",

View File

@ -20,10 +20,10 @@
<item>
<title><![CDATA[{{@ $value.title }}]]></title>
<description><![CDATA[{{@ $value.description || $value.title }}]]></description>
{{ if $value.pubDate }}
<pubDate>{{ $value.pubDate }}</pubDate>{{ /if }}
{{ if $value.pubDate }}<pubDate>{{ $value.pubDate }}</pubDate>{{ /if }}
<guid>{{ $value.guid || $value.link }}</guid>
<link>{{ $value.link }}</link>
{{ if $value.author }}<author><![CDATA[{{ $value.author }}]]></author>{{ /if }}
</item>
{{ /each }}
</channel>