add logic to truncate long headlines fetched from websites
This commit is contained in:
@ -295,7 +295,7 @@ module.exports = {
|
|||||||
var metaImage = $("meta[property='og:image']");
|
var metaImage = $("meta[property='og:image']");
|
||||||
var urlImage = metaImage.attr('content') ? metaImage.attr('content') : '';
|
var urlImage = metaImage.attr('content') ? metaImage.attr('content') : '';
|
||||||
var description = metaDescription.attr('content') ? metaDescription.attr('content') : '';
|
var description = metaDescription.attr('content') ? metaDescription.attr('content') : '';
|
||||||
result.title = $('title').text();
|
result.title = $('title').text().length < 141 ? $('title').text() : $('title').text().slice(0, 137) + " ...";
|
||||||
result.image = urlImage;
|
result.image = urlImage;
|
||||||
result.description = description;
|
result.description = description;
|
||||||
callback(null, result);
|
callback(null, result);
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
"<div class='col-xs-12'>" +
|
"<div class='col-xs-12'>" +
|
||||||
"<span>" +
|
"<span>" +
|
||||||
"<a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' href='/stories/" + linkedName + "'>discuss</a> · " +
|
"<a class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' href='/stories/" + linkedName + "'>discuss</a> · " +
|
||||||
|
"<button class='btn btn-no-shadow btn-primary btn-xs btn-primary-ghost' id='#upvote'>upvote</a></button> · " +
|
||||||
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
rank + (rank > 1 ? " points" : " point") + " · posted " +
|
||||||
moment(data[i].timePosted).fromNow() +
|
moment(data[i].timePosted).fromNow() +
|
||||||
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username + "</a> " +"</a> " +
|
" by <a href='/" + data[i].author.username + "'>@" + data[i].author.username + "</a> " +"</a> " +
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
.col-xs-12.col-md-1
|
.col-xs-12.col-md-1
|
||||||
label.control-label.control-label-story-submission(for='name') Title
|
label.control-label.control-label-story-submission(for='name') Title
|
||||||
.col-xs-12.col-md-11
|
.col-xs-12.col-md-11
|
||||||
input#story-title.form-control(placeholder='Type a headline for your link here', name='Title', maxlength='140' autofocus)
|
input#story-title.form-control(placeholder='Type a headline for your link here', name='Title', maxlength='90' autofocus)
|
||||||
.form-group
|
.form-group
|
||||||
.col-xs-12.col-md-1
|
.col-xs-12.col-md-1
|
||||||
label.control-label.control-label-story-submission(for='name') Description
|
label.control-label.control-label-story-submission(for='name') Description
|
||||||
|
Reference in New Issue
Block a user