diff --git a/client/template.js b/client/template.js index d797c61b1..fec379b9d 100644 --- a/client/template.js +++ b/client/template.js @@ -1,4 +1,4 @@ -module.exports = async (name, props={})=>{ +module.exports = async(name, title = '', props = {})=>{ return ` @@ -7,7 +7,7 @@ module.exports = async (name, props={})=>{ - The Homebrewery - NaturalCrit + ${title.length ? `${title} - The Homebrewery`: 'The Homebrewery - NaturalCrit'}
${require(`../build/${name}/ssr.js`)(props)}
@@ -16,4 +16,4 @@ module.exports = async (name, props={})=>{ `; -}; +}; \ No newline at end of file diff --git a/server.js b/server.js index a268a3219..d0c77528f 100644 --- a/server.js +++ b/server.js @@ -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); + }); });