kiln/templates.go

45 lines
1.1 KiB
Go
Raw Normal View History

2020-09-29 20:42:27 +00:00
package main
// TODO: Use go:embed
2020-10-01 01:57:59 +00:00
// Default atom feed template
2020-09-29 20:42:27 +00:00
const atom_xml = `<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ .Title }}</title>
2020-09-30 01:30:50 +00:00
<link href="{{ .URL }}"/>
<link rel="self" href="{{ .URL }}{{ .Path }}"/>
2020-09-30 04:27:59 +00:00
<updated>{{ .Updated.Format "2006-01-02T15:04:05Z07:00" }}</updated>
2020-09-30 01:30:50 +00:00
<id>{{ .URL }}{{ .Path }}</id>
{{- $url := .URL -}}
{{- range .Entries }}
2020-09-29 20:42:27 +00:00
<entry>
<title>{{ .Title }}</title>
2020-09-30 01:30:50 +00:00
<link href="{{ $url }}{{ .Permalink }}"/>
<id>{{ $url }}{{ .Permalink }}</id>
2020-09-29 20:42:27 +00:00
<updated>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
2020-09-30 01:30:50 +00:00
<content src="{{ $url }}{{ .Permalink }}" type="text/gemini"></content>
2020-09-29 20:42:27 +00:00
</entry>
2020-09-30 01:30:50 +00:00
{{ end -}}
2020-09-29 20:42:27 +00:00
</feed>`
2020-10-01 01:57:59 +00:00
// Default directory index template
2020-09-29 20:42:27 +00:00
const index_gmi = `# Index of {{ .Permalink }}
2020-09-30 01:30:50 +00:00
{{ range .Dirs }}=> {{ .Permalink }}
{{ end -}}
2020-09-29 20:42:27 +00:00
{{ range .Pages }}=> {{ .Permalink }}
2020-09-30 01:30:50 +00:00
{{ end -}}`
2020-09-29 20:42:27 +00:00
2020-10-01 01:57:59 +00:00
// Default page template
2020-09-29 20:42:27 +00:00
const page_gmi = `# {{ .Title }}
{{ .Content }}`
2020-10-01 01:57:59 +00:00
// Default template for html output
const output_html = `<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>{{ .Title }}</title>
{{ .Content }}`