support 404 page

This commit is contained in:
Mark McGranaghan 2012-10-09 16:29:16 -07:00
parent 35669e7100
commit d08c19b44e
2 changed files with 25 additions and 0 deletions

24
template/404.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
<title>Go by Example: Not Found</title>
<link rel=stylesheet href="site.css">
</head>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34996217-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<body>
<div id="intro">
<h2>Go by Example</h2>
<p>Sorry, we couldn't find that!</p>
</div>
</body>
</html>

View File

@ -239,6 +239,7 @@ func main() {
ensureDir(siteDir) ensureDir(siteDir)
copyFile("template/site.css", siteDir+"/site.css") copyFile("template/site.css", siteDir+"/site.css")
copyFile("template/favicon.ico", siteDir+"/favicon.ico") copyFile("template/favicon.ico", siteDir+"/favicon.ico")
copyFile("template/404.html", siteDir+"/404.html")
chapters := parseChapters() chapters := parseChapters()
renderIndex(chapters) renderIndex(chapters)
renderChapters(chapters) renderChapters(chapters)