_metadata.pug 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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(name="description" , content=metadata.description)
  18. meta(itemprop="description" , content=metadata.description)
  19. //-twitter and og descriptions handeled in their sections below
  20. else
  21. meta(name="description", content=translate("site_description"))
  22. meta(itemprop="description", content=translate("site_description"))
  23. //- Image
  24. if (metadata && metadata.image && metadata.image.fields)
  25. //- from the CMS
  26. meta(itemprop="image", content=metadata.image.fields.file.url)
  27. meta(name="image", content=metadata.image.fields.file.url)
  28. else if (metadata && metadata.image_src)
  29. //- pages with custom metadata images, metadata.image_src is the full image URL
  30. meta(itemprop="image", content=metadata.image_src)
  31. meta(name="image", content=metadata.image_src)
  32. else if (settings.overleaf)
  33. //- the default image for Overleaf
  34. meta(itemprop="image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  35. meta(name="image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  36. else
  37. //- the default image for Overleaf Community Edition/Server Pro
  38. meta(itemprop="image", content='/touch-icon-192x192.png')
  39. meta(name="image", content='/touch-icon-192x192.png')
  40. //- Keywords
  41. if (metadata && metadata.keywords)
  42. meta(name="keywords" content=metadata.keywords)
  43. //- Misc
  44. meta(itemprop="name", content=settings.appName + ", the Online LaTeX Editor")
  45. if (metadata && metadata.robotsNoindexNofollow)
  46. meta(name="robots" content="noindex, nofollow")
  47. //- Twitter
  48. meta(name="twitter:card", content=metadata && metadata.twitterCardType ? metadata.twitterCardType : 'summary')
  49. if (settings.social && settings.social.twitter && settings.social.twitter.handle)
  50. meta(name="twitter:site", content="@" + settings.social.twitter.handle)
  51. if (metadata && metadata.twitterDescription)
  52. meta(name="twitter:description", content=metadata.twitterDescription)
  53. else
  54. meta(name="twitter:description", content=translate("site_description"))
  55. if (metadata && metadata.twitterImage && metadata.twitterImage.fields)
  56. //- from the CMS
  57. meta(name="twitter:image", content=metadata.twitterImage.fields.file.url)
  58. meta(name="twitter:image:alt", content=metadata.twitterImage.fields.title)
  59. else if (settings.overleaf)
  60. //- the default image for Overleaf
  61. meta(name="twitter:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  62. else
  63. //- the default image for Overleaf Community Edition/Server Pro
  64. meta(name="twitter:image", content='/touch-icon-192x192.png')
  65. //- Open Graph
  66. //- to do - add og:url
  67. if (settings.social && settings.social.facebook && settings.social.facebook.appId)
  68. meta(property="fb:app_id", content=settings.social.facebook.appId)
  69. if (metadata && metadata.openGraphDescription)
  70. meta(property="og:description", content=metadata.openGraphDescription)
  71. else
  72. meta(property="og:description", content=translate("site_description"))
  73. if (metadata && metadata.openGraphImage && metadata.openGraphImage.fields)
  74. //- from the CMS
  75. meta(property="og:image", content=metadata.openGraphImage.fields.file.url)
  76. else if (settings.overleaf)
  77. //- the default image for Overleaf
  78. meta(property="og:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  79. else
  80. //- the default image for Overleaf Community Edition/Server Pro
  81. meta(property="og:image", content='/touch-icon-192x192.png')
  82. if (metadata && metadata.openGraphType)
  83. meta(property="og:type", metadata.openGraphType)
  84. else
  85. meta(property="og:type", content="website")
  86. if (metadata && metadata.openGraphVideo)
  87. //- from the CMS
  88. meta(property="og:video", content=metadata.openGraphVideo)
  89. //- Viewport
  90. if !metadata || metadata.viewport !== false
  91. meta(name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes")
  92. //- Noindex
  93. if settings.robotsNoindex
  94. meta(name="robots" content="noindex")
  95. //- Apple devices
  96. meta(name="apple-mobile-web-app-capable" content="yes")
  97. meta(name="apple-mobile-web-app-status-bar-style" content="black-translucent")
  98. //- Icons
  99. link(rel="icon", href="/favicon.ico")
  100. link(rel="icon", sizes="192x192", href="/touch-icon-192x192.png")
  101. link(rel="apple-touch-icon-precomposed", href="/apple-touch-icon-precomposed.png")
  102. link(rel="mask-icon", href="/mask-favicon.svg", color="#138A07")
  103. //- Canonical Tag for SEO
  104. if (metadata && metadata.canonicalURL)
  105. link(rel="canonical" href=metadata.canonicalURL)