mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add canonical url tag and don't include query string
This commit is contained in:
parent
9019b20d50
commit
c9a17982cf
2 changed files with 4 additions and 1 deletions
|
@ -123,7 +123,9 @@ module.exports = (app, webRouter, apiRouter)->
|
||||||
res.locals.translate = (key, vars = {}) ->
|
res.locals.translate = (key, vars = {}) ->
|
||||||
vars.appName = Settings.appName
|
vars.appName = Settings.appName
|
||||||
req.i18n.translate(key, vars)
|
req.i18n.translate(key, vars)
|
||||||
res.locals.currentUrl = req.originalUrl
|
# Don't include the query string parameters, otherwise Google
|
||||||
|
# treats ?nocdn=true as the canonical version
|
||||||
|
res.locals.currentUrl = Url.parse(req.originalUrl).pathname
|
||||||
next()
|
next()
|
||||||
|
|
||||||
webRouter.use (req, res, next)->
|
webRouter.use (req, res, next)->
|
||||||
|
|
|
@ -21,6 +21,7 @@ html(itemscope, itemtype='http://schema.org/Product')
|
||||||
link(rel="icon", href="/favicon.ico")
|
link(rel="icon", href="/favicon.ico")
|
||||||
link(rel='stylesheet', href=buildCssPath('/style.css'))
|
link(rel='stylesheet', href=buildCssPath('/style.css'))
|
||||||
|
|
||||||
|
link(rel="canonical", href=settings.siteUrl+currentUrl)
|
||||||
if settings.i18n.subdomainLang
|
if settings.i18n.subdomainLang
|
||||||
each subdomainDetails in settings.i18n.subdomainLang
|
each subdomainDetails in settings.i18n.subdomainLang
|
||||||
if !subdomainDetails.hide
|
if !subdomainDetails.hide
|
||||||
|
|
Loading…
Reference in a new issue