wombat/initer/templates.go

191 lines
5.2 KiB
Go

package initer
var defaultTemplate string = `<!DOCTYPE html>
<html>
<head><title>{{.Title}}</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!-- Tell "smart" phones that they are as wide as they are wide... -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<style>
{{.Style}}
</style>
</head>
<body>
<h1>{{if .Blogpost}}{{.Blogname}}: {{end}}{{.Title}}</h1>
<div class="navigation">
<a href="/">home</a>
<a href="/blog">blog</a>
<a href="/photos/pages/">photos</a>
</div>
{{if .Subpages}}
<dl>
{{range $index, $subpage := .Subpages}}
<dt><a href="/{{$subpage.Path}}">[{{$subpage.Title}}]</a></dt><dd>{{$subpage.Description}}</dd>
{{end}}
</dl>
{{end}}
{{if .Description}}<h3>{{.Description}}</h3>{{end}}
{{if .PostCollection}}
<h2><a href="/{{.Blogdir}}/categories.html">Categories</a> &nbsp; &nbsp; <a href="/{{.Blogdir}}/timeline.html">Timeline</a></h2>
{{range $index, $post := .PostCollection}}
<div class="blogpost">
<a href ="{{$post.Link}}" class="linktopost">
<h1>
{{$post.Title}}
</h1>
</a>
{{$post.Content}}
</div>
{{end}}
{{end}}
<div class="content">
{{.Content}}
</div>
{{if .Categories}}
<div class="categories">
Posted in
{{range $index, $category := .Categories}}
<a href="{{$category.Path}}">{{$category.Name}}</a>
{{end}}
</div>
{{end}}
{{if .Time}}
<div class="time">
{{.Time}}
</div>
{{end}}
{{if or .Previous .Later}}
<div class="blognavigation">
{{if .Previous}}
<a href="{{.Previous}}"><h2>&lt;--Previous</h2></a>
{{end}}
{{if .Later}}
<a href="{{.Later}}"><h2>Later--&gt;</h2></a>
{{end}}
</div>
{{end}}
</body>
</html>
`
/******************************************************************************/
// external JavaScript and CSS - definitely not recommended
var bsStarterTemplate string = `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell "smart" phones that they are as wide as they are wide... -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<title>{{.Title}}</title>
<style>
{{.Style}}
</style>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="/">Home</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active"><a class="nav-link" href="/blog">Blog</a></li>
<li class="nav-item active"><a class="nav-link" href="/photos/pages/">Photos</a></li>
</li>
</ul>
</div>
</nav>
<main role="main" class="container">
<div class="starter-template">
<h1>{{if .Blogpost}}{{.Blogname}}: {{end}}{{.Title}}</h1>
{{if .Subpages}}
<dl>
{{range $index, $subpage := .Subpages}}
<dt><a href="/{{$subpage.Path}}">[{{$subpage.Title}}]</a></dt><dd>{{$subpage.Description}}</dd>
{{end}}
</dl>
{{end}}
{{if .Description}}<h3>{{.Description}}</h3>{{end}}
{{if .PostCollection }}
{{range $index, $post := .PostCollection}}
<div class="blogpost">
<a href ="{{$post.Link}}" class="linktopost">
<h1>
{{$post.Title}}
</h1>
</a>
{{$post.Content}}
</div>
{{end}}
{{end}}
<div class="content">
{{.Content}}
</div>
{{if .Categories}}
<div class="categories">
Posted in
{{range $index, $category := .Categories}}
<a href="{{$category.Path}}">{{$category.Name}}</a>
{{end}}
</div>
{{end}}
{{if .Time}}
<div class="time">
{{.Time}}
</div>
{{end}}
{{if or .Previous .Later}}
<div class="blognavigation">
{{if .Previous}}
<a href="{{.Previous}}"><h2>&lt;--Previous</h2></a>
{{end}}
{{if .Later}}
<a href="{{.Later}}"><h2>Later--&gt;</h2></a>
{{end}}
</div>
{{end}}
{{if .PostCollection}}
<a href="/{{.Blogdir}}/categories.html"><h2>Categories</h2></a>
<a href="/{{.Blogdir}}/timeline.html"><h2>Timeline</h2></a>
{{end}}
</div>
</main><!-- /.container -->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.clownflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
`