layout-base.pug 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. doctype html
  2. html(
  3. lang=(currentLngCode || 'en')
  4. class=(fixedSizeDocument ? 'fixed-size-document' : undefined)
  5. )
  6. - metadata = metadata || {}
  7. - bootstrap5EnabledPage = false
  8. block entrypointVar
  9. block vars
  10. head
  11. include ./_metadata.pug
  12. - var bootstrapVersion = bootstrap5EnabledPage && splitTestVariants['bootstrap-5'] === 'enabled' ? 5 : 3
  13. //- Stylesheet
  14. link(rel='stylesheet', href=buildCssPath(getCssThemeModifier(userSettings, brandVariation), bootstrapVersion), id="main-stylesheet")
  15. block css
  16. each file in entrypointStyles(entrypoint)
  17. link(rel='stylesheet', href=file)
  18. block _headLinks
  19. if (typeof(suppressRelAlternateLinks) == "undefined")
  20. if settings.i18n.subdomainLang
  21. each subdomainDetails in settings.i18n.subdomainLang
  22. if !subdomainDetails.hide
  23. link(rel="alternate", href=subdomainDetails.url+currentUrl, hreflang=subdomainDetails.lngCode)
  24. if (entrypoint !== 'marketing')
  25. link(rel="preload", href=buildJsPath(currentLngCode + "-json.js"), as="script", nonce=scriptNonce)
  26. //- Scripts
  27. if (typeof(suppressGoogleAnalytics) == "undefined")
  28. include _google_analytics
  29. block meta
  30. meta(name="ol-csrfToken" content=csrfToken)
  31. //- Configure dynamically loaded assets (via webpack) to be downloaded from CDN
  32. //- See: https://webpack.js.org/guides/public-path/#on-the-fly
  33. meta(name="ol-baseAssetPath" content=buildBaseAssetPath())
  34. meta(name="ol-mathJaxPath" content=mathJaxPath)
  35. meta(name="ol-usersEmail" content=getUserEmail())
  36. meta(name="ol-ab" data-type="json" content={})
  37. meta(name="ol-user_id" content=getLoggedInUserId())
  38. //- Internationalisation settings
  39. meta(name="ol-i18n" data-type="json" content={
  40. currentLangCode: currentLngCode
  41. })
  42. //- Expose some settings globally to the frontend
  43. meta(name="ol-ExposedSettings" data-type="json" content=ExposedSettings)
  44. meta(name="ol-splitTestVariants" data-type="json" content=splitTestVariants || {})
  45. meta(name="ol-splitTestInfo" data-type="json" content=splitTestInfo || {})
  46. if (typeof(settings.algolia) != "undefined")
  47. meta(name="ol-algolia" data-type="json" content={
  48. appId: settings.algolia.app_id,
  49. apiKey: settings.algolia.read_only_api_key,
  50. indexes: settings.algolia.indexes
  51. })
  52. meta(name="ol-isManagedAccount" data-type="boolean" content=isManagedAccount)
  53. each restriction in userRestrictions || []
  54. meta(name='ol-cannot-' + restriction data-type="boolean" content=true)
  55. meta(name="ol-bootstrapVersion" data-type="json" content=bootstrapVersion)
  56. block head-scripts
  57. body(ng-csp=(cspEnabled ? "no-unsafe-eval" : false) class=(showThinFooter ? 'thin-footer' : undefined))
  58. if(settings.recaptcha && settings.recaptcha.siteKeyV3)
  59. script(type="text/javascript", nonce=scriptNonce, src="https://www.recaptcha.net/recaptcha/api.js?render="+settings.recaptcha.siteKeyV3, defer=deferScripts)
  60. if (typeof(suppressSkipToContent) == "undefined")
  61. a(class="skip-to-content" href="#main-content") #{translate('skip_to_content')}
  62. block body
  63. if (settings.splitTest.devToolbar.enabled)
  64. div#dev-toolbar
  65. block foot-scripts
  66. each file in entrypointScripts(entrypoint)
  67. script(type="text/javascript", nonce=scriptNonce, src=file, defer=deferScripts)
  68. if (settings.splitTest.devToolbar.enabled)
  69. each file in entrypointScripts("devToolbar")
  70. script(type="text/javascript", nonce=scriptNonce, src=file, defer=deferScripts)
  71. script(type="text/javascript", nonce=scriptNonce).
  72. window.addEventListener('DOMContentLoaded', function() {
  73. //- Look for bundle
  74. var cdnBlocked = typeof Frontend === 'undefined'
  75. //- Prevent loops
  76. var noCdnAlreadyInUrl = window.location.href.indexOf("nocdn=true") != -1
  77. if (cdnBlocked && !noCdnAlreadyInUrl && navigator.userAgent.indexOf("Googlebot") == -1) {
  78. //- Set query param, server will not set CDN url
  79. window.location.search += "&nocdn=true";
  80. }
  81. })