Skip to content
template.go 833 B
Newer Older
Lo^2's avatar
Lo^2 committed
package common

import (
	"html/template"
)

func MustParseTemplate(content string) *template.Template {
	return template.Must(template.Must(template.New("content").Parse(content)).New("container").Parse(TEMPLATE_CONTAINER_STR))
}

const TEMPLATE_CONTAINER_STR = `<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
Lo^2's avatar
Lo^2 committed
		<title>{{.PageTitle}}</title>
Lo^2's avatar
Lo^2 committed
		<meta name="viewport" content="width=device-width, initial-scale=1">
Lo^2's avatar
Lo^2 committed
		<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
		<style type="text/css">
			body {
				padding: 1em;
				max-width:50em;
			}
Lo^2's avatar
Lo^2 committed

			#openclose {
				margin: 1em 0em;
			}
Lo^2's avatar
Lo^2 committed
		</style>
	</head>
	<body>
		{{template "content" $}}
	</body>
</html>
`