blob: 09cd2fedbaf9f74d977bd2fc3b122b303906ffe4 [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}}
<link href="/static/frontend/frontend.min.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>
{{template "header" .}}
{{template "main" .}}
{{template "footer" .}}
{{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>