_metadata.pug 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //- Title
  2. if metadata && metadata.title
  3. title(translate='no')= 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(translate='no')= settings.appName + ', ' + translate('online_latex_editor')
  8. meta(
  9. name='twitter:title'
  10. content=settings.appName + ', ' + translate('online_latex_editor')
  11. )
  12. meta(
  13. name='og:title'
  14. content=settings.appName + ', ' + translate('online_latex_editor')
  15. )
  16. else
  17. title(translate='no')= translate(title) + ' - ' + settings.appName + ', ' + translate('online_latex_editor')
  18. //- to do - not translate?
  19. meta(name='twitter:title' content=translate(title))
  20. meta(name='og:title' content=translate(title))
  21. //- Description
  22. if metadata && metadata.description
  23. meta(name='description' content=metadata.description)
  24. meta(itemprop='description' content=metadata.description)
  25. //-twitter and og descriptions handeled in their sections below
  26. else
  27. meta(name='description' content=translate('site_description'))
  28. meta(itemprop='description' content=translate('site_description'))
  29. //- Image
  30. if metadata && metadata.image && metadata.image.fields
  31. //- from the CMS
  32. meta(itemprop='image' content=metadata.image.fields.file.url)
  33. meta(name='image' content=metadata.image.fields.file.url)
  34. else if metadata && metadata.image_src
  35. //- pages with custom metadata images, metadata.image_src is the full image URL
  36. meta(itemprop='image' content=metadata.image_src)
  37. meta(name='image' content=metadata.image_src)
  38. else if settings.overleaf
  39. //- the default image for Overleaf
  40. meta(itemprop='image' content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  41. meta(name='image' content=buildImgPath('ol-brand/overleaf_og_logo.png'))
  42. else
  43. //- the default image for Overleaf Community Edition/Server Pro
  44. meta(itemprop='image' content=buildBaseAssetPath() + 'apple-touch-icon.png')
  45. meta(name='image' content=buildBaseAssetPath() + 'apple-touch-icon.png')
  46. //- Keywords
  47. if metadata && metadata.keywords
  48. meta(name='keywords' content=metadata.keywords)
  49. //- Misc
  50. meta(itemprop='name' content=settings.appName + ', the Online LaTeX Editor')
  51. if metadata && metadata.robotsNoindexNofollow
  52. meta(name='robots' content='noindex, nofollow')
  53. //- Twitter
  54. meta(
  55. name='twitter:card'
  56. content=metadata && metadata.twitterCardType ? metadata.twitterCardType : 'summary'
  57. )
  58. if settings.social && settings.social.twitter && settings.social.twitter.handle
  59. meta(name='twitter:site' content='@' + settings.social.twitter.handle)
  60. if metadata && metadata.twitterDescription
  61. meta(name='twitter:description' content=metadata.twitterDescription)
  62. else
  63. meta(name='twitter:description' content=translate('site_description'))
  64. if metadata && metadata.twitterImage && metadata.twitterImage.fields
  65. //- from the CMS
  66. meta(name='twitter:image' content=metadata.twitterImage.fields.file.url)
  67. meta(name='twitter:image:alt' content=metadata.twitterImage.fields.title)
  68. else if settings.overleaf
  69. //- the default image for Overleaf
  70. meta(
  71. name='twitter:image'
  72. content=buildImgPath('ol-brand/overleaf_og_logo.png')
  73. )
  74. else
  75. //- the default image for Overleaf Community Edition/Server Pro
  76. meta(
  77. name='twitter:image'
  78. content=buildBaseAssetPath() + 'apple-touch-icon.png'
  79. )
  80. //- Open Graph
  81. //- to do - add og:url
  82. if settings.social && settings.social.facebook && settings.social.facebook.appId
  83. meta(property='fb:app_id' content=settings.social.facebook.appId)
  84. if metadata && metadata.openGraphDescription
  85. meta(property='og:description' content=metadata.openGraphDescription)
  86. else
  87. meta(property='og:description' content=translate('site_description'))
  88. if metadata && metadata.openGraphImage && metadata.openGraphImage.fields
  89. //- from the CMS
  90. meta(property='og:image' content=metadata.openGraphImage.fields.file.url)
  91. else if settings.overleaf
  92. //- the default image for Overleaf
  93. meta(
  94. property='og:image'
  95. content=buildImgPath('ol-brand/overleaf_og_logo.png')
  96. )
  97. else
  98. //- the default image for Overleaf Community Edition/Server Pro
  99. meta(
  100. property='og:image'
  101. content=buildBaseAssetPath() + 'apple-touch-icon.png'
  102. )
  103. if metadata && metadata.openGraphType
  104. meta(property='og:type' metadata.openGraphType)
  105. else
  106. meta(property='og:type' content='website')
  107. if metadata && metadata.openGraphVideo
  108. //- from the CMS
  109. meta(property='og:video' content=metadata.openGraphVideo)
  110. //- Viewport
  111. if !metadata || metadata.viewport !== false
  112. meta(
  113. name='viewport'
  114. content='width=device-width, initial-scale=1.0, user-scalable=yes'
  115. )
  116. //- Noindex
  117. if settings.robotsNoindex
  118. meta(name='robots' content='noindex')
  119. //- Icons
  120. link(rel='icon' sizes='32x32' href=buildBaseAssetPath() + 'favicon-32x32.png')
  121. link(rel='icon' sizes='16x16' href=buildBaseAssetPath() + 'favicon-16x16.png')
  122. link(rel='icon' href=buildBaseAssetPath() + 'favicon.svg' type='image/svg+xml')
  123. link(rel='apple-touch-icon' href=buildBaseAssetPath() + 'apple-touch-icon.png')
  124. link(
  125. rel='mask-icon'
  126. href=buildBaseAssetPath() + 'mask-favicon.svg'
  127. color='#046530'
  128. )
  129. //- Canonical Tag for SEO
  130. if metadata && metadata.canonicalURL
  131. link(rel='canonical' href=metadata.canonicalURL)
  132. //- Manifest
  133. //- Does not currently contain a start_url to prevent browser installation prompts
  134. link(
  135. rel='manifest'
  136. href=buildBaseAssetPath() + 'web.sitemanifest.json'
  137. crossorigin=settings.isCodeSpace ? 'use-credentials' : false
  138. )