Using Golang to statically generate your Web site

Gophers Meetup #18 (November 2016)

Kai Hendry

Why static HTML?

Golang HTML templates

How most 2016 production sites look like nowadays

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Web application</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
<div id="app"></div>
<script src="/dist/FIVE-MEGABYTE-bundle.js"></script>
</body>
</html>

Lets throw in Golang to statify non-dynamic routes

Tips

Test

Code demos

{{ template "header" . }}
<h1>404</h1>
{{ template "footer" }}
</body>
</html>

Thank you