meteor-meta-extractor
meteor-meta-extractor copied to clipboard
Why description catch twiter description instead meta description?
I'm using this package for fill a collection with title and description from url, the code is this:
"submit .js-save-website-form": function (event) {
var title, description;
// here is an example of how to get the url out of the form:
var url = event.target.url.value;
console.log("The url they entered is: " + url);
extractMeta(url, function (err, res) {
console.log(res);
console.log(res.title);
console.log(res.description);
if (event.target.title.value) {
title = event.target.title.value;
} else {
title = res.title;
}
if (event.target.description.value) {
description = event.target.description.value;
} else {
// decoding HTML special characters in res.description
// creating a text area with red.description as the HTML.
// them putting textarea.value in desc
console.log('res.description: ', res.description);
var textArea = document.createElement('textarea');
textArea.innerHTML = res.description;
description = textArea.value;
console.log('Description: ', description);
}
// var cleanKeywords = cleanString(title, desc);
// var keywords = createKeywords(cleanKeywords);
// If user logged in, insert website
// put your website saving code in here!
if (Meteor.user()) {
Websites.insert({
title: title,
url: url,
description: description,
votesUp: 0,
votesDown: 0,
createdOn: new Date(),
createdBy: Meteor.user()._id
});
}
});
$('#website_form').modal('hide');
return false;// stop the form submit from reloading the page
}
When i fill this form i have a surprise: this take the twitter description instead meta description. You can see there a comparative images:
I don't understand why happen this, can you help me?