_metadata.pug 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //- Title
  2. -if (metadata && metadata.title)
  3. title= metadata.title + ' - ' + settings.appName + ', ' + translate("online_latex_editor")
  4. meta(name="twitter:title", content=metadata.title)
  5. meta(name="og:title", content=metadata.title)
  6. -else if (typeof(title) == "undefined")
  7. title= settings.appName + ', '+ translate("online_latex_editor")
  8. meta(name="twitter:title", content=settings.appName + ', '+ translate("online_latex_editor"))
  9. meta(name="og:title", content=settings.appName + ', '+ translate("online_latex_editor"))
  10. -else
  11. title= translate(title) + ' - ' + settings.appName + ', ' + translate("online_latex_editor")
  12. //- to do - not translate?
  13. meta(name="twitter:title", content=translate(title))
  14. meta(name="og:title", content=translate(title))
  15. //- Description
  16. -if (metadata && metadata.description)
  17. meta(itemprop="description", name="description" , content=metadata.description)
  18. //-twitter and og descriptions handeled below
  19. -else
  20. meta(itemprop="description", name="description", content=translate("site_description"))
  21. meta(itemprop="description", name="twitter:description", content=translate("site_description"))
  22. meta(itemprop="description", name="og:description", content=translate("site_description"))
  23. //- Image
  24. -if (metadata && metadata.image)
  25. //- from the CMS
  26. meta(itemprop="image", name="image", content=metadata.image.fields.file.url)
  27. -else if (metadata && metadata.image_src)
  28. //- pages with custom metadata images, metadata.image_src is the full image URL
  29. meta(itemprop="image", name="image", content=metadata.image_src)
  30. -else if (settings.overleaf)
  31. //- the default image for Overleaf
  32. meta(itemprop="image", name="image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  33. -else
  34. //- the default image for ShareLaTeX
  35. meta(itemprop="image", name="image", content='/touch-icon-192x192.png')
  36. //- Keywords
  37. -if (metadata && metadata.keywords)
  38. meta(name="keywords" content=metadata.keywords)
  39. //- Misc
  40. meta(itemprop="name", content=settings.appName + ", the Online LaTeX Editor")
  41. -if (metadata && metadata.robotsNoindexNofollow)
  42. meta(name="robots" content="noindex, nofollow")
  43. //- Twitter
  44. meta(name="twitter:card", content=metadata && metadata.twitterCardType ? metadata.twitterCardType : 'summary')
  45. -if (settings.social && settings.social.twitter && settings.social.twitter.handle)
  46. meta(name="twitter:site", content="@" + settings.social.twitter.handle)
  47. -if (metadata && metadata.twitterDescription)
  48. meta(itemprop="twitter:description", content=metadata.twitterDescription)
  49. -if (metadata && metadata.twitterImage)
  50. //- from the CMS
  51. meta(itemprop="image", name="twitter:image", content=metadata.twitterImage.fields.file.url)
  52. meta(itemprop="image", name="twitter:image:alt", content=metadata.twitterImage.fields.title)
  53. -else if (settings.overleaf)
  54. //- the default image for Overleaf
  55. meta(itemprop="image", name="twitter:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  56. -else
  57. //- the default image for ShareLaTeX
  58. meta(itemprop="image", name="twitter:image", content='/touch-icon-192x192.png')
  59. //- Open Graph
  60. //- to do - add og:url
  61. -if (settings.social && settings.social.facebook && settings.social.facebook.appId)
  62. meta(name="fb:app_id", content=settings.social.facebook.appId)
  63. -if (metadata && metadata.openGraphDescription)
  64. meta(itemprop="description", name="og:description", content=metadata.openGraphDescription)
  65. -if (metadata && metadata.openGraphImage)
  66. //- from the CMS
  67. meta(itemprop="image", name="og:image", content=metadata.openGraphImage.fields.file.url)
  68. -else if (settings.overleaf)
  69. //- the default image for Overleaf
  70. meta(itemprop="image", name="og:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  71. -else
  72. //- the default image for ShareLaTeX
  73. meta(itemprop="image", name="og:image", content='/touch-icon-192x192.png')
  74. -if (metadata && metadata.openGraphType)
  75. meta(name="og:type", metadata.openGraphType)
  76. -else
  77. meta(name="og:type", content="website")
  78. //- Viewport
  79. if metadata && metadata.viewport
  80. meta(name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=yes;")