blob: e07d196d955fd44a05df18ecec24e204a898e8c1 [file] [log] [blame]
<!--
Copyright 2021 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<!DOCTYPE html>
<html lang="en" data-layout="{{if .UseResponsiveLayout}}responsive{{end}}">
<head>
<!-- This will capture unhandled errors during page load for reporting later. -->
<script>
window.addEventListener('error', window.__err=function f(e){f.p=f.p||[];f.p.push(e)});
</script>
<script>
(function() {
const theme = document.cookie.match(/prefers-color-scheme=(light|dark|auto)/)?.[1]
if (theme) {
document.querySelector('html').setAttribute('data-theme', theme);
}
}())
</script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{block "description" .}}
<meta name="description" content="Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.">
{{end}}
{{block "robots" .}}{{end}}
<meta class="js-gtmID" data-gtmid="{{.GoogleTagManagerID}}">
<link rel="shortcut icon" href="/static/shared/icon/favicon.ico">
{{block "canonical" .}}{{end}}
<!-- Only load the css reset for non-legacy pages -->
{{if not .UseSiteWrapper}}
<link href="/static/shared/reset.css?version={{.AppVersionLabel}}" rel="stylesheet">
{{end}}
<link href="/static/frontend/frontend.css?version={{.AppVersionLabel}}" rel="stylesheet">
{{block "title" .}}
<title>pkg.go.dev</title>
{{end}}
{{block "pre-content" .}}{{end}}
</head>
<body>
<!-- loadScript appends JS sources to the document head. It loads scripts as asynchronous
modules eliminating parser-blocking JavaScript. -->
<script>
function loadScript(src) {
let s = document.createElement('script');
s.src = src;
s.type = 'module';
s.async = true;
s.defer = true
document.head.appendChild(s);
}
loadScript("/static/frontend/frontend.js");
</script>
{{if .UseSiteWrapper}}
<div class="Site Site--wide Site--redesign">
{{end}}
{{template "header" .}}
{{if .UseSiteWrapper}}
<div class="Site-content">
{{end}}
{{template "main" .}}
{{if .UseSiteWrapper}}
</div>
{{end}}
{{template "footer" .}}
{{if .UseSiteWrapper}}
</div>
{{end}}
{{if .GoogleTagManagerID}}
<script>
// this will throw if the querySelector can’t find the element
const gtmId = document.querySelector('.js-gtmID').dataset.gtmid;
if (!gtmId) {
throw new Error('Google Tag Manager ID not found');
}
loadScript(`https://www.googletagmanager.com/gtm.js?id=${gtmId}`);
</script>
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id={{.GoogleTagManagerID}}"
height="0" width="0" style="display:none;visibility:hidden">
</iframe>
</noscript>
{{end}}
{{block "post-content" .}}{{end}}
</body>
</html>