include enclosure only if thumbnail is present
This commit is contained in:
parent
e49d6e4917
commit
2dbfffb055
|
@ -51,12 +51,16 @@ module.exports = function() {
|
||||||
if(is_self_link)
|
if(is_self_link)
|
||||||
link.url = link.permalink
|
link.url = link.permalink
|
||||||
|
|
||||||
let thumb_mime = ''
|
let enclosure = ''
|
||||||
|
if(thumbnail != '') {
|
||||||
|
let mime = ''
|
||||||
let ext = thumbnail.split('.').pop()
|
let ext = thumbnail.split('.').pop()
|
||||||
if(ext === 'png')
|
if(ext === 'png')
|
||||||
thumb_mime = 'image/png'
|
mime = 'image/png'
|
||||||
else
|
else
|
||||||
thumb_mime = 'image/jpeg'
|
mime = 'image/jpeg'
|
||||||
|
enclosure = `<enclosure length="0" type="${mime}" url="${thumbnail}" />`
|
||||||
|
}
|
||||||
|
|
||||||
let append_desc_html = `<br/><a href="${link.url}">[link]</a> <a href="${link.permalink}">[comments]</a>`
|
let append_desc_html = `<br/><a href="${link.url}">[link]</a> <a href="${link.permalink}">[comments]</a>`
|
||||||
|
|
||||||
|
@ -68,7 +72,7 @@ module.exports = function() {
|
||||||
<domain>${link.domain}</domain>
|
<domain>${link.domain}</domain>
|
||||||
<id>${link.id}</id>
|
<id>${link.id}</id>
|
||||||
<thumbnail>${thumbnail}</thumbnail>
|
<thumbnail>${thumbnail}</thumbnail>
|
||||||
<enclosure length="0" type="${thumb_mime}" url="${thumbnail}" />
|
${enclosure}
|
||||||
<link>${link.permalink}</link>
|
<link>${link.permalink}</link>
|
||||||
<url>${link.url}</url>
|
<url>${link.url}</url>
|
||||||
<description><![CDATA[${unescape(link.selftext_html)}${append_desc_html}]]></description>
|
<description><![CDATA[${unescape(link.selftext_html)}${append_desc_html}]]></description>
|
||||||
|
|
Loading…
Reference in New Issue