Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
redirect skipped article instead of 404ing it (#424)
Browse files Browse the repository at this point in the history
redirect skipped article instead of 404ing it
  • Loading branch information
apaleslimghost authored Dec 3, 2019
2 parents 0625227 + 509e74f commit c847c0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 9 additions & 0 deletions server/controllers/amp-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
const assembleArticle = require('../lib/article/assemble');
const analytics = require('../lib/analytics');

// HACK: redirect certain articles to ft.com
const articlesToSkip = [
'263615ca-d873-11e9-8f9b-77216ebe1f17', // general election poll tracker: contains image that shouldn't be cached
];

module.exports = (req, res, next) => {
if(articlesToSkip.includes(req.params.uuid)) {
return res.redirect(`https://www.ft.com/content/${req.params.uuid}`);
}

assembleArticle(req.params.uuid, {
development: req.app.isDevelopment,
production: req.app.isProduction,
Expand Down
6 changes: 0 additions & 6 deletions server/lib/article/assemble.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ const extraArticleData = (article, options) => promiseAllObj({
css: getCSS(article, options),
}).then(extra => Object.assign(article, extra));

// HACK: hide certain articles from the AMP cache
const articlesToSkip = [
'263615ca-d873-11e9-8f9b-77216ebe1f17', // general election poll tracker: contains image that shouldn't be cached
];

const assembleArticle = (uuid, options) => {
options = Object.assign({}, environmentOptions, options);

Expand All @@ -74,7 +69,6 @@ const assembleArticle = (uuid, options) => {
if(response
&& (!response.originatingParty || response.originatingParty === 'FT')
&& (!response.type || response.type === 'article')
&& (!articlesToSkip.includes(uuid))
) {
return response;
}
Expand Down

0 comments on commit c847c0e

Please sign in to comment.