wombat/initer/templates.go

136 lines
3.1 KiB
Go
Raw Permalink Normal View History

2019-01-01 19:41:03 +01:00
package initer
const defaultRSSTemplate string = `<?xml version="1.0" encoding="UTF-8"?>
2020-10-29 12:01:30 +01:00
<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>
`
const defaultTemplate string = `<!DOCTYPE html>
2019-01-01 19:41:03 +01:00
<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}}
<style>{{.Style}}</style>
<script>{{.Script}}</script>
2019-01-01 19:41:03 +01:00
</head>
<body>
<div class="navigation" id="navigation">
2019-01-01 19:41:03 +01:00
<a href="/">home</a>
<a href="/blog/">blog</a>
2019-01-01 19:41:03 +01:00
<a href="/photos/pages/">photos</a>
<a href="javascript:void(0);" class="burger" onclick="retard()"></a>
2019-01-01 19:41:03 +01:00
</div>
2023-03-05 14:26:23 +01:00
<h1>{{if .Blogpost}}{{.Blogname}}: {{end}}{{.Title}}</h1>
{{if .Description}}<h3>{{.Description}}</h3>{{end}}
2019-01-01 19:41:03 +01:00
{{if .Subpages}}
<dl>
{{range $index, $subpage := .Subpages}}
<dt><a href="/{{$subpage.Path}}">[{{$subpage.Title}}]</a></dt><dd>{{$subpage.Description}}</dd>
{{end}}
</dl>
{{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">
<h1>
<a href ="{{$post.Link}}" class="linktopost">{{$post.Title}}</a>
2019-01-01 19:41:03 +01:00
</h1>
{{$post.Content}}
</div>
{{end}}
{{end}}
2019-01-01 19:41:03 +01:00
<div class="content">
2023-04-08 17:21:10 +02:00
{{.Content}}
2023-04-08 17:21:10 +02: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">
{{.Time}} UTC
</div>
{{end}}
{{if .CategoryListings}}
{{if .Blogpost}}
<div class="relatedListing">
Related posts:
{{else}}
<div class="categoryListing">
{{end}}
<dl>
{{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}}
2019-01-01 19:41:03 +01:00
</div>
2023-04-08 17:21:10 +02:00
2019-01-01 19:41:03 +01:00
{{if or .Previous .Later}}
<div class="blognavigation">
{{if .Previous}}
<h2><a href="{{.Previous}}">&lt;--Previous</a></h2>
2019-01-01 19:41:03 +01:00
{{end}}
{{if .Later}}
<h2><a href="{{.Later}}"><h2>Later--&gt;</a></h2>
2019-01-01 19:41:03 +01:00
{{end}}
</div>
{{end}}
</body>
</html>
`