0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 15:32:40 +00:00

Merge pull request #1075 from RKuerten/fix-brew-title

Changed page title to show the brew title
This commit is contained in:
Trevor Buckner
2020-10-26 13:38:17 -04:00
committed by GitHub
2 changed files with 9 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
module.exports = async (name, props={})=>{
module.exports = async(name, title = '', props = {})=>{
return `
<!DOCTYPE html>
<html>
@@ -7,7 +7,7 @@ module.exports = async (name, props={})=>{
<link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
<link href=${`/${name}/bundle.css`} rel='stylesheet'></link>
<link rel="icon" href="/assets/homebrew/favicon.ico" type="image/x-icon" />
<title>The Homebrewery - NaturalCrit</title>
<title>${title.length ? `${title} - The Homebrewery`: 'The Homebrewery - NaturalCrit'}</title>
</head>
<body>
<main id="reactRoot">${require(`../build/${name}/ssr.js`)(props)}</main>
@@ -16,4 +16,4 @@ module.exports = async (name, props={})=>{
<script>start_app(${JSON.stringify(props)})</script>
</html>
`;
};
};

View File

@@ -219,12 +219,12 @@ app.use((req, res)=>{
googleBrews : req.googleBrews,
account : req.account,
};
templateFn('homebrew', props)
.then((page)=>{res.send(page);})
.catch((err)=>{
console.log(err);
return res.sendStatus(500);
});
templateFn('homebrew', title = req.brew ? req.brew.title : '', props)
.then((page)=>{ res.send(page); })
.catch((err)=>{
console.log(err);
return res.sendStatus(500);
});
});