Skip to content

Commit

Permalink
rss: add author field to v2ex (DIYgod#229)
Browse files Browse the repository at this point in the history
* rss: add author field to v2ex

* rss: add username to v2ex description

* rss: v2ex use content_rendered to description
  • Loading branch information
WhiteWorld authored and DIYgod committed Jun 2, 2018
1 parent 1428399 commit 12a7390
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion routes/v2ex/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
};
};
3 changes: 3 additions & 0 deletions views/json.art
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}",
Expand Down
4 changes: 2 additions & 2 deletions views/rss.art
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 12a7390

Please sign in to comment.