layout-base.pug 3.7 KB

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