blob: 36b79ef0acb67569f2cdda11295bcd486493f81d [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>
<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}}
<meta class="js-gtmID" data-gtmid="{{.GoogleTagManagerID}}">
<link rel="shortcut icon" href="/static/_icon/favicon.ico">
<!-- Only load the css reset for non-legacy pages -->
{{if not .UseSiteWrapper}}
<link href="/static/_base/reset.css" rel="stylesheet">
{{end}}
<link href="/static/_base/base.css" 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/_base/base.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>