245 lines
6.6 KiB
Go
245 lines
6.6 KiB
Go
package initer
|
|
|
|
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>
|
|
`
|
|
|
|
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 .PostCollection}}
|
|
<link rel="alternate" type="application/rss+xml" title="RSS" href="/{{.Blogdir}}/feed.rss">
|
|
{{end}}
|
|
<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> <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}}
|
|
|
|
{{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}}
|
|
|
|
</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><--Previous</h2></a>
|
|
{{end}}
|
|
{{if .Later}}
|
|
<a href="{{.Later}}"><h2>Later--></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 .PostCollection}}
|
|
<link rel="alternate" type="application/rss+xml" title="RSS" href="/{{.Blogdir}}/feed.rss">
|
|
{{end}}
|
|
<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><--Previous</h2></a>
|
|
{{end}}
|
|
{{if .Later}}
|
|
<a href="{{.Later}}"><h2>Later--></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>
|
|
`
|