_metadata.pug 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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='/apple-touch-icon.png')
  45. meta(name='image' content='/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(name='twitter:image' content='/apple-touch-icon.png')
  77. //- Open Graph
  78. //- to do - add og:url
  79. if settings.social && settings.social.facebook && settings.social.facebook.appId
  80. meta(property='fb:app_id' content=settings.social.facebook.appId)
  81. if metadata && metadata.openGraphDescription
  82. meta(property='og:description' content=metadata.openGraphDescription)
  83. else
  84. meta(property='og:description' content=translate('site_description'))
  85. if metadata && metadata.openGraphImage && metadata.openGraphImage.fields
  86. //- from the CMS
  87. meta(property='og:image' content=metadata.openGraphImage.fields.file.url)
  88. else if settings.overleaf
  89. //- the default image for Overleaf
  90. meta(
  91. property='og:image'
  92. content=buildImgPath('ol-brand/overleaf_og_logo.png')
  93. )
  94. else
  95. //- the default image for Overleaf Community Edition/Server Pro
  96. meta(property='og:image' content='/apple-touch-icon.png')
  97. if metadata && metadata.openGraphType
  98. meta(property='og:type' metadata.openGraphType)
  99. else
  100. meta(property='og:type' content='website')
  101. if metadata && metadata.openGraphVideo
  102. //- from the CMS
  103. meta(property='og:video' content=metadata.openGraphVideo)
  104. //- Viewport
  105. if !metadata || metadata.viewport !== false
  106. meta(
  107. name='viewport'
  108. content='width=device-width, initial-scale=1.0, user-scalable=yes'
  109. )
  110. //- Noindex
  111. if settings.robotsNoindex
  112. meta(name='robots' content='noindex')
  113. //- Icons
  114. link(rel='icon' sizes='32x32' href='/favicon-32x32.png')
  115. link(rel='icon' sizes='16x16' href='/favicon-16x16.png')
  116. link(rel='icon' href='/favicon.svg' type='image/svg+xml')
  117. link(rel='apple-touch-icon' href='/apple-touch-icon.png')
  118. link(rel='mask-icon' href='/mask-favicon.svg' color='#046530')
  119. //- Canonical Tag for SEO
  120. if metadata && metadata.canonicalURL
  121. link(rel='canonical' href=metadata.canonicalURL)
  122. //- Manifest
  123. //- Does not currently contain a start_url to prevent browser installation prompts
  124. link(rel='manifest' href='/web.sitemanifest')