Add Twitter cards for albums and tracks

This commit is contained in:
Jonathan Cremin 2014-12-06 13:20:27 +00:00
parent d8d88de74c
commit 65af698a78
2 changed files with 9 additions and 3 deletions

View file

@ -26,7 +26,7 @@ module.exports = function(req, res, next) {
req.db.matches.findOne({_id:serviceId + itemId}).then(function(doc) {
if (doc) {
res.render(type, {page: type, title: doc.items[0].name + " by " + doc.items[0].artist.name, items: doc.items});
res.render(type, {page: type, title: doc.items[0].name + " by " + doc.items[0].artist.name, item: doc.items[0], items: doc.items});
} else {
Q.timeout(services[serviceId].lookupId(itemId, type), 5000).then(function(item) {
for (var id in services) {
@ -54,7 +54,7 @@ module.exports = function(req, res, next) {
items.unshift(item);
req.db.matches.save({_id:serviceId + itemId, items:items});
res.render(type, {page: type, title: item.name + " by " + item.artist.name, items: items});
res.render(type, {page: type, title: item.name + " by " + item.artist.name, item: item, items: items});
});
}, function(error) {
if (error.code == "ETIMEDOUT") {

View file

@ -6,8 +6,14 @@
<title><% if (locals.title) { %><%= title %> - <% } %>Match Audio</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<% if (locals.item) { %>
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@MatchAudio">
<meta name="twitter:title" content="<%= item.name + " by " + item.artist.name %>">
<meta name="twitter:description" content="We've matched this music on Rdio, Spotify, Deezer, Beats Music, Google Music and iTunes so you can open it in the service you use" />
<meta name="twitter:image" content="<%= item.artwork %>" />
<% } %>
<link rel="shortcut icon" href="/images/favicon.png">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/stylesheets/style.css">