diff --git a/controllers/story.js b/controllers/story.js index 394ece6300..5c32741461 100644 --- a/controllers/story.js +++ b/controllers/story.js @@ -76,7 +76,7 @@ exports.returnIndividualStory = function(req, res, next) { } story = story.pop(); - var dashedNameFull = story.headline.toLowerCase().replace(/\s/g, '-'); + var dashedNameFull = story.storyLink.toLowerCase().replace(/\s/g, '-'); if (dashedNameFull !== dashedName) { return res.redirect('../stories/' + dashedNameFull); } diff --git a/seed_data/comments.json b/seed_data/comments.json index 11fa35aa87..c44dc44f37 100644 --- a/seed_data/comments.json +++ b/seed_data/comments.json @@ -1,15 +1,3 @@ [ - { - "associatedPost": "54f584db16cd6570aa176eda", - "body": "cats like to sit around and be lazy as hell", - "rank": "1", - "upvotes": [], - "author": { - "username" : "terakilonoob", - "picture": "https://thedrinkingtraveler.files.wordpress.com/2015/02/24127-funny-grumpy-cat-memesvery-bad-morning-meme-0rlh4r5c-wallpaper-1024x1024.jpg", - "id" : "ade671aa0756dc61bd485f45" - }, - "comments": [], - "topLevel": true - } + ] \ No newline at end of file diff --git a/seed_data/stories.json b/seed_data/stories.json index 246950ec44..c44dc44f37 100644 --- a/seed_data/stories.json +++ b/seed_data/stories.json @@ -1,84 +1,3 @@ [ - { - "headline": "Cat sits on keyboard 0", - "storyLink": "cat sits on keyboard 0", - "link": "http://kotaku.com/5991046/why-cats-love-sitting-on-keyboards", - "description": "cats love keyboards you know", - "rank": 0, - "upVotes": [], - "timePosted": 1425429660000, - "author": { - "username": "testuser", - "userId": "a2ad135e2aa27c14fc73ee11", - "picture": "http://www.cutecatgifs.com/wp-content/uploads/2013/11/little_guy_sleeping_in_lap.gif" - }, - "comments": [], - "image": "http://rossmounce.co.uk/wp-content/uploads/2014/11/grumpy-cat-no-1.jpg" -}, - { - "headline": "Cat sits on keyboard 1", - "storyLink": "cat sits on keyboard 1", - "link": "http://kotaku.com/5991046/why-cats-love-sitting-on-keyboards", - "description": "cats love keyboards you know", - "rank": 1, - "upVotes": [], - "timePosted": 1425429660000, - "author": { - "username": "testuser", - "userId": "a2ad135e2aa27c14fc73ee22", - "picture": "http://www.cutecatgifs.com/wp-content/uploads/2013/11/little_guy_sleeping_in_lap.gif" - }, - "comments": [], - "image": "http://rossmounce.co.uk/wp-content/uploads/2014/11/grumpy-cat-no-1.jpg" -}, - { - "headline": "Cat sits on keyboard 3", - "storyLink": "cat sits on keyboard 3", - "link": "http://kotaku.com/5991046/why-cats-love-sitting-on-keyboards", - "description": "cats love keyboards you know", - "rank": 3, - "upVotes": [], - "timePosted": 1425429660000, - "author": { - "username": "testuser", - "userId": "a2ad135e2aa27c14fc73ee33", - "picture": "http://www.cutecatgifs.com/wp-content/uploads/2013/11/little_guy_sleeping_in_lap.gif" - }, - "comments": [], - "image": "http://rossmounce.co.uk/wp-content/uploads/2014/11/grumpy-cat-no-1.jpg" -}, - { - "headline": "Cat sits on keyboard 20", - "storyLink": "cat sits on keyboard 20", - "link": "http://kotaku.com/5991046/why-cats-love-sitting-on-keyboards", - "description": "ipsizzle dolizzle sit amet, ghetto adipiscing elit. Nullam fo shizzle velizzle, aliquet volutpizzle, suscipizzle shiz, gravida vizzle, arcu. Pellentesque izzle tortor. Sizzle doggy. Boom shackalack izzle dolizzle dapibizzle ass tempizzle tellivizzle. Ma nizzle we gonna chung shiz izzle tellivizzle. Vestibulum dizzle tortor. Pellentesque pimpin' rhoncus you son of a bizzle. In dizzle habitasse platea dictumst. Donec dapibizzle. Curabitizzle pot yippiyo, pretizzle da bomb, mattis izzle, da bomb vitae, nunc. Ass suscipizzle. Cool sempizzle bow wow wow sed purus.", - "rank": 20, - "upVotes": [], - "timePosted": 1425429660000, - "author": { - "username": "testuser", - "userId": "a2ad135e2aa27c14fc73ee44", - "picture": "http://www.cutecatgifs.com/wp-content/uploads/2013/11/little_guy_sleeping_in_lap.gif" - }, - "comments": [ - "54f61b0e43f0c2b90f162ec4" - ], - "image": "http://rossmounce.co.uk/wp-content/uploads/2014/11/grumpy-cat-no-1.jpg" -}, - { - "headline": "Cat sits on keyboard 2", - "storyLink": "cat sits on keyboard 2", - "link": "http://kotaku.com/5991046/why-cats-love-sitting-on-keyboards", - "description": "cats love keyboards you know", - "rank": 2, - "upVotes": [], - "timePosted": 1425429660000, - "author": { - "username": "testuser", - "userId": "a2ad135e2aa27c14fc73ee55", - "picture": "http://www.cutecatgifs.com/wp-content/uploads/2013/11/little_guy_sleeping_in_lap.gif" - }, - "comments": [], - "image": "http://rossmounce.co.uk/wp-content/uploads/2014/11/grumpy-cat-no-1.jpg" - } + ] \ No newline at end of file diff --git a/views/stories/hot-stories.jade b/views/stories/hot-stories.jade index 7fb206cb0d..c30cd444ab 100644 --- a/views/stories/hot-stories.jade +++ b/views/stories/hot-stories.jade @@ -4,7 +4,7 @@ h3 script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js") script. var getLinkedName = function getLinkedName(name) { - return name.toLowerCase().replace(/\s/g, '-'); + return name.trim().toLowerCase().replace(/\s/g, '-'); } $.ajax({ url: '/stories/hotStories',