Consisten dasherization in stories. Updated story cleanup script.
This commit is contained in:
@ -137,7 +137,9 @@ exports.returnIndividualStory = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
story = story.pop();
|
story = story.pop();
|
||||||
var dashedNameFull = story.storyLink.toLowerCase().replace(/\s/g, '-');
|
var dashedNameFull = story.storyLink.toLowerCase()
|
||||||
|
.replace(/\s+/g, ' ')
|
||||||
|
.replace(/\s/g, '-');
|
||||||
if (dashedNameFull !== dashedName) {
|
if (dashedNameFull !== dashedName) {
|
||||||
return res.redirect('../news/' + dashedNameFull);
|
return res.redirect('../news/' + dashedNameFull);
|
||||||
}
|
}
|
||||||
@ -328,9 +330,6 @@ exports.storySubmission = function(req, res, next) {
|
|||||||
return next(new Error('Not authorized'));
|
return next(new Error('Not authorized'));
|
||||||
}
|
}
|
||||||
var storyLink = data.headline
|
var storyLink = data.headline
|
||||||
.replace(/\'/g, '')
|
|
||||||
.replace(/\"/g, '')
|
|
||||||
.replace(/,/g, '')
|
|
||||||
.replace(/\s+/g, ' ')
|
.replace(/\s+/g, ' ')
|
||||||
.replace(/[^a-z0-9\s]/gi, '')
|
.replace(/[^a-z0-9\s]/gi, '')
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
@ -18,8 +18,8 @@ function storyLinkCleanup(cb) {
|
|||||||
console.log(i++);
|
console.log(i++);
|
||||||
this.pause();
|
this.pause();
|
||||||
story.storyLink = story.storyLink.
|
story.storyLink = story.storyLink.
|
||||||
replace(/[^a-z0-9\s]/gi, '').
|
|
||||||
replace(/\s+/g, ' ').
|
replace(/\s+/g, ' ').
|
||||||
|
replace(/[^a-z0-9\s]/gi, '').
|
||||||
toLowerCase().
|
toLowerCase().
|
||||||
trim();
|
trim();
|
||||||
story.save(function (err) {
|
story.save(function (err) {
|
||||||
|
Reference in New Issue
Block a user