_metadata.pug 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. //- Twitter
  42. meta(name="twitter:card", content=metadata && metadata.twitterCardType ? metadata.twitterCardType : 'summary')
  43. -if (settings.social && settings.social.twitter && settings.social.twitter.handle)
  44. meta(name="twitter:site", content="@" + settings.social.twitter.handle)
  45. -if (metadata && metadata.twitterDescription)
  46. meta(itemprop="twitter:description", content=metadata.twitterDescription)
  47. -if (metadata && metadata.twitterImage)
  48. //- from the CMS
  49. meta(itemprop="image", name="twitter:image", content=metadata.twitterImage.fields.file.url)
  50. meta(itemprop="image", name="twitter:image:alt", content=metadata.twitterImage.fields.title)
  51. -else if (settings.overleaf)
  52. //- the default image for Overleaf
  53. meta(itemprop="image", name="twitter:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  54. -else
  55. //- the default image for ShareLaTeX
  56. meta(itemprop="image", name="twitter:image", content='/touch-icon-192x192.png')
  57. //- Open Graph
  58. //- to do - add og:url
  59. -if (settings.social && settings.social.facebook && settings.social.facebook.appId)
  60. meta(name="fb:app_id", content=settings.social.facebook.appId)
  61. -if (metadata && metadata.openGraphDescription)
  62. meta(itemprop="description", name="og:description", content=metadata.openGraphDescription)
  63. -if (metadata && metadata.openGraphImage)
  64. //- from the CMS
  65. meta(itemprop="image", name="og:image", content=metadata.openGraphImage.fields.file.url)
  66. -else if (settings.overleaf)
  67. //- the default image for Overleaf
  68. meta(itemprop="image", name="og:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  69. -else
  70. //- the default image for ShareLaTeX
  71. meta(itemprop="image", name="og:image", content='/touch-icon-192x192.png')
  72. -if (metadata && metadata.openGraphType)
  73. meta(name="og:type", metadata.openGraphType)
  74. -else
  75. meta(name="og:type", content="website")
  76. //- Viewport
  77. if metadata && metadata.viewport
  78. meta(name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=yes;")