Two exact paths a crawler asks for by name, so they are mux entries rather than resolver cases — no bundle can collide, since a key always sits under a section. robots.txt at the site root is served verbatim, because a site that ships one has said something deliberate; otherwise the engine emits the minimum that is true and points at the sitemap. The sitemap lists every bundle in every language it exists in, since each variant is separately reachable, with lastmod only where a bundle has a date. Every URL comes from content.URL like every other path the engine emits, so a sitemap cannot disagree with what is actually served. Both need a declared base. Without one the sitemap answers 404 rather than listing paths no crawler can resolve, and robots omits the Sitemap line rather than writing a relative one. write() was setting text/html for every caller, and headers only go out with the first byte — so a handler setting its own type would have had it silently replaced, which is how a sitemap gets served as a web page. It now splits into write and writeAs, and the tests assert the content types rather than only the bodies.
28 lines
752 B
HTML
28 lines
752 B
HTML
{{define "base" -}}
|
|
<!doctype html>
|
|
<html lang="{{.Lang}}">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>{{.Title}}{{if .Site.Title}} · {{.Site.Title}}{{end}}</title>
|
|
<link rel="canonical" href="{{.Canonical}}">
|
|
{{- range .Alternates}}
|
|
<link rel="alternate" hreflang="{{.Lang}}" href="{{.URL}}">
|
|
{{- end}}
|
|
<meta property="og:title" content="{{.Title}}">
|
|
<meta property="og:url" content="{{.Canonical}}">
|
|
<meta property="og:type" content="article">
|
|
<meta property="og:locale" content="{{.Lang}}">
|
|
{{- if .Site.Title}}
|
|
<meta property="og:site_name" content="{{.Site.Title}}">
|
|
{{- end}}
|
|
<style>{{.Style}}</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
{{- template "main" .}}
|
|
</main>
|
|
</body>
|
|
</html>
|
|
{{- end}}
|