wombat/initer/templates.go

265 lines
7.2 KiB
Go
Raw Normal View History

2019-01-01 19:41:03 +01:00
package initer
2020-10-29 12:01:30 +01:00
var rssTemplate string = `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>YOUR TITLE</title>
<link>LINK TO YOUR BLOG</link>
<description>DESCRIPTION OF YOUR BLOG</description>
{{range $index, $post := .}}
{{- if (lt $index 10)}}
<item>
<title>{{$post.Meta.Title}}</title>
<content:encoded><![CDATA[ {{$post.Content}} ]]></content:encoded>
<link>BASE ADDRESS OF YOUR BLOG{{$post.Link}}</link>
<pubDate>{{$post.Meta.RFC1123Date}}</pubDate>
</item>
{{end}}
{{- end}}
</channel>
</rss>
`
2019-01-01 19:41:03 +01:00
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=">
{{if or .PostCollection .Blogpost}}
2020-10-29 12:11:08 +01:00
<link rel="alternate" type="application/rss+xml" title="RSS" href="/{{.Blogdir}}/feed.rss">
2020-10-29 12:01:30 +01:00
{{end}}
2019-01-01 19:41:03 +01:00
<style>
{{.Style}}
</style>
</head>
<body>
<h1>{{if .Blogpost}}{{.Blogname}}: {{end}}{{.Title}}</h1>
<div class="navigation">
<a href="/">home</a>
<a href="/blog/">blog</a>
2019-01-01 19:41:03 +01:00
<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>
2019-01-01 19:41:03 +01:00
{{range $index, $post := .PostCollection}}
<div class="blogpost">
<a href ="{{$post.Link}}" class="linktopost">
<h1>
{{$post.Title}}
</h1>
</a>
{{$post.Content}}
</div>
{{end}}
{{end}}
2019-01-01 19:41:03 +01:00
<div class="content">
{{.Content}}
{{if .CategoryListings}}
<div class="categoryListing">
<dl style="padding-bottom:150em;">
{{range $i, $listing := .CategoryListings -}}
<dt><a name="{{$listing.ASCIIName}}" class="categoryListing">{{$listing.Name}}</a></dt>
{{range $j, $post := $listing.Posts -}}
<dd><a href="{{$post.Link}}">{{$post.Meta.Title}}</a></dd>
{{end}}
{{end}}
</dl>
2019-01-01 19:41:03 +01:00
</div>
{{end}}
{{if .TimelineListing}}
<div class="timelineListing">
{{range $i, $post := .TimelineListing -}}
2020-10-19 10:11:50 +02:00
{{$post.Meta.FormattedDate}}: <a href="{{$post.Link}}" class="timelineListing">{{$post.Meta.Title}}</a><br>
{{end}}
</div>
{{end}}
</div>
2019-01-01 19:41:03 +01:00
{{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">
2020-10-29 13:16:18 +01:00
{{.Time}} UTC
2019-01-01 19:41:03 +01:00
</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=">
{{if or .PostCollection .Blogpost}}
2020-10-29 12:11:08 +01:00
<link rel="alternate" type="application/rss+xml" title="RSS" href="/{{.Blogdir}}/feed.rss">
2020-10-29 12:01:30 +01:00
{{end}}
2019-01-01 19:41:03 +01:00
<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>
2019-01-01 19:41:03 +01:00
</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 }}
<h2><a href="/{{.Blogdir}}/categories.html">Categories</a> &nbsp; &nbsp; <a href="/{{.Blogdir}}/timeline.html">Timeline</a></h2>
2019-01-01 19:41:03 +01:00
{{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}}
{{if .CategoryListings}}
<div class="categoryListing">
<dl style="padding-bottom:150em;">
{{range $i, $listing := .CategoryListings -}}
<dt><a name="{{$listing.ASCIIName}}" class="categoryListing">{{$listing.Name}}</a></dt>
{{range $j, $post := $listing.Posts -}}
<dd><a href="{{$post.Link}}">{{$post.Meta.Title}}</a></dd>
{{end}}
{{end}}
</dl>
</div>
{{end}}
{{if .TimelineListing}}
<div class="timelineListing">
{{range $i, $post := .TimelineListing -}}
{{$post.Meta.FormattedDate}}: <a href="{{$post.Link}}" class="timelineListing">{{$post.Meta.Title}}</a><br>
{{end}}
</div>
{{end}}
2019-01-01 19:41:03 +01:00
</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">
2020-10-29 13:16:18 +01:00
{{.Time}} UTC
2019-01-01 19:41:03 +01:00
</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}}
</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>
2019-01-01 19:41:03 +01:00
</body>
</html>
`