added 'show' layout with custom header info
This commit is contained in:
parent
2463bbf257
commit
b393de8268
4 changed files with 35 additions and 17 deletions
|
@ -79,7 +79,7 @@ module.exports = (app) => {
|
||||||
}
|
}
|
||||||
// serve the file or the show route
|
// serve the file or the show route
|
||||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||||
res.status(200).render('show', { fileInfo });
|
res.status(200).render('show', { layout: 'show', fileInfo });
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
|
errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
|
||||||
|
@ -97,7 +97,7 @@ module.exports = (app) => {
|
||||||
}
|
}
|
||||||
// serve the show route
|
// serve the show route
|
||||||
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
|
||||||
res.status(200).render('show', { fileInfo });
|
res.status(200).render('show', { layout: 'show', fileInfo });
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
|
errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
|
||||||
|
|
24
speech.js
24
speech.js
|
@ -72,21 +72,15 @@ const hbs = expressHandlebars.create({
|
||||||
return options.inverse(this);
|
return options.inverse(this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grouped_each (every, context, options) {
|
twitterCard (type) {
|
||||||
let out = '';
|
return new Handlebars.SafeString(`
|
||||||
let subcontext = [];
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
let i;
|
<meta name="twitter:site" content="@spee.ch">
|
||||||
if (context && context.length > 0) {
|
<meta name="twitter:creator" content="@SarahMaslinNir">
|
||||||
for (i = 0; i < context.length; i++) {
|
<meta name="twitter:title" content="Parade of Fans for Houston’s Funeral">
|
||||||
if (i > 0 && i % every === 0) {
|
<meta name="twitter:description" content="NEWARK - The guest list and parade of limousines with celebrities emerging from them seemed more suited to a red carpet event in Hollywood or New York than than a gritty stretch of Sussex Avenue near the former site of the James M. Baxter Terrace public housing project here.">
|
||||||
out += options.fn(subcontext);
|
<meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-articleLarge.jpg">
|
||||||
subcontext = [];
|
`);
|
||||||
}
|
|
||||||
subcontext.push(context[i]);
|
|
||||||
}
|
|
||||||
out += options.fn(subcontext);
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<title>Spee.ch</title>
|
<title>Spee.ch</title>
|
||||||
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
|
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
|
||||||
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
||||||
|
{{ twitterCard }}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{{ body }}}
|
{{{ body }}}
|
||||||
|
|
23
views/layouts/show.handlebars
Normal file
23
views/layouts/show.handlebars
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Spee.ch</title>
|
||||||
|
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
|
||||||
|
<!-- twitter card -->
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:site" content="@spee.ch">
|
||||||
|
<meta name="twitter:creator" content="@spee.ch">
|
||||||
|
<meta name="twitter:title" content="{{fileInfo.name}}">
|
||||||
|
<meta name="twitter:description" content="An image hosted via Spee.ch">
|
||||||
|
<meta name="twitter:image" content="/api/streamFile/{{fileInfo.fileName}}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{{{ body }}}
|
||||||
|
<!-- google analytics -->
|
||||||
|
{{ googleAnalytics }}
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue