Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #64 from ft-interactive/rss-feed
Browse files Browse the repository at this point in the history
Added pubDate tag to each RSS feed item
  • Loading branch information
Sumeet Adur committed Dec 29, 2015
2 parents b327c41 + 618a90c commit 10426e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
13 changes: 4 additions & 9 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import jsonTransform from 'gulp-json-transform';
import mkdirp from 'mkdirp';
import mergeStream from 'merge-stream';
import path from 'path';
import php from 'phpjs';
import prettyData from 'gulp-pretty-data';
import rename from 'gulp-rename';
import runSequence from 'run-sequence';
Expand Down Expand Up @@ -290,13 +291,6 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)
sortedWords[word] = words[word];
}

let monthNames = [
"January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December"
];

for (const row of spreadsheet) {
let currentSlug = slugify(row.word);
let currentWord = words[currentSlug];
Expand Down Expand Up @@ -336,8 +330,8 @@ gulp.task('download-data', () => fetch(SPREADSHEET_URL)
currentWord.wordid = currentWord.wordid.substring(4,currentWord.wordid.length);
}

let date = new Date(currentWord.submissiondate);
currentWord.formatteddate = monthNames[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear();
currentWord.formatteddate = php.date('F j, Y', php.strtotime(currentWord.submissiondate));
currentWord.pubdate = php.date('r', php.strtotime(currentWord.submissiondate));

const tweetTextString = `“${currentWord.word}”: Corporate language crime no. ${currentWord.wordid} https://ig.ft.com/sites/guffipedia/${currentSlug}`;
const tweetTextRSSTemplate = Handlebars.compile('{{tweetText}}');
Expand Down Expand Up @@ -428,6 +422,7 @@ gulp.task('create-rss-feed', () => {
rssString += `<description>${currentWord.tweettextrss}</description>`;
rssString += `<link>${rssLink}${slug}/</link>`;
rssString += `<guid>${rssLink}${slug}/</guid>`;
rssString += `<pubDate>${currentWord.pubdate}/</pubDate>`;
rssString += `<guff:formatteddate>${currentWord.formatteddate}</guff:formatteddate>`;
rssString += `<guff:slug>${currentWord.slug}</guff:slug>`;
rssString += `<guff:wordid>${currentWord.wordid}</guff:wordid>`;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"mkdirp": "^0.5.1",
"node-fetch": "^1.3.3",
"nodemon": "^1.8.1",
"phpjs": "^1.3.2",
"run-sequence": "^1.1.4",
"subdir": "0.0.3",
"vinyl-buffer": "^1.0.0",
Expand Down

0 comments on commit 10426e8

Please sign in to comment.