fixed rss feed for ie7
This commit is contained in:
parent
b50c6ea4a2
commit
bc2a56383d
@ -34,6 +34,7 @@
|
|||||||
}
|
}
|
||||||
-->
|
-->
|
||||||
</style>
|
</style>
|
||||||
|
<link rel='alternate' type='application/rss+xml' title='HowFeed RSS Feed' href='/rss.xml'>
|
||||||
</head>
|
</head>
|
||||||
<body style="width: 640px;">
|
<body style="width: 640px;">
|
||||||
<table width="640" cellspacing="0" cellpadding="0" border="0">
|
<table width="640" cellspacing="0" cellpadding="0" border="0">
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
import RSS from 'rss';
|
|
||||||
import Article from '../models/article.js';
|
|
||||||
|
|
||||||
export async function get(req, res)
|
|
||||||
{
|
|
||||||
let feed = new RSS();
|
|
||||||
let articles = await Article.find().populate({
|
|
||||||
path: 'author',
|
|
||||||
select: 'realname avatar'
|
|
||||||
}).populate({
|
|
||||||
path: 'category'
|
|
||||||
});
|
|
||||||
|
|
||||||
for (let article of articles) {
|
|
||||||
feed.item({
|
|
||||||
title: article.title,
|
|
||||||
description: article.html,
|
|
||||||
url: `http://howfeed.biz/a/${article.slug}`,
|
|
||||||
categories: [ article.category.name ],
|
|
||||||
author: article.author.realname,
|
|
||||||
date: article.created_at,
|
|
||||||
enclosure: {
|
|
||||||
url: `http://howfeed.biz/a/${article.image}`
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
res.writeHead(200, {
|
|
||||||
'Content-Type': 'application/rss+xml'
|
|
||||||
});
|
|
||||||
res.end(feed.xml());
|
|
||||||
}
|
|
@ -13,6 +13,7 @@ import fs from 'fs';
|
|||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import helmet from 'helmet';
|
import helmet from 'helmet';
|
||||||
import useragent from 'useragent';
|
import useragent from 'useragent';
|
||||||
|
import RSS from 'rss';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import Article from './models/article.js';
|
import Article from './models/article.js';
|
||||||
@ -391,7 +392,44 @@ mainRouter
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
|
.get('/rss.xml', async function (req, res) {
|
||||||
|
let year = new Date().getFullYear();
|
||||||
|
let feed = new RSS({
|
||||||
|
title: 'HowFeed.biz Articles',
|
||||||
|
feed_url: 'http://howfeed.biz/rss.xml',
|
||||||
|
site_url: 'http://howfeed.biz/',
|
||||||
|
image_url: 'http://howfeed.biz/logo.png',
|
||||||
|
language: 'en',
|
||||||
|
webMaster: 'webmaster@howfeed.biz',
|
||||||
|
copyright: `${year} FemboyFinancial Holdings Co., Ltd. (USA LLC)`
|
||||||
|
});
|
||||||
|
let articles = await Article.find().populate({
|
||||||
|
path: 'author',
|
||||||
|
select: 'realname avatar'
|
||||||
|
}).populate({
|
||||||
|
path: 'category'
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let article of articles) {
|
||||||
|
feed.item({
|
||||||
|
title: article.title,
|
||||||
|
description: article.html,
|
||||||
|
url: `http://howfeed.biz/a/${article.slug}`,
|
||||||
|
categories: [ article.category.name ],
|
||||||
|
author: article.author.realname,
|
||||||
|
date: article.created_at,
|
||||||
|
enclosure: {
|
||||||
|
url: `http://howfeed.biz/a/${article.image}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
res.writeHead(200, {
|
||||||
|
'Content-Type': 'application/rss+xml'
|
||||||
|
});
|
||||||
|
res.end(feed.xml());
|
||||||
|
});
|
||||||
|
|
||||||
app.use(helmet())
|
app.use(helmet())
|
||||||
.use(cors())
|
.use(cors())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user