kiln/templates.go

45 lines
1.1 KiB
Go

package main
// TODO: Use go:embed
// Default atom feed template
const atom_xml = `<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ .Title }}</title>
<link href="{{ .URL }}"/>
<link rel="self" href="{{ .URL }}{{ .Path }}"/>
<updated>{{ .Updated.Format "2006-01-02T15:04:05Z07:00" }}</updated>
<id>{{ .URL }}{{ .Path }}</id>
{{- $url := .URL -}}
{{- range .Entries }}
<entry>
<title>{{ .Title }}</title>
<link href="{{ $url }}{{ .Permalink }}"/>
<id>{{ $url }}{{ .Permalink }}</id>
<updated>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
<content src="{{ $url }}{{ .Permalink }}" type="text/gemini"></content>
</entry>
{{ end -}}
</feed>`
// Default directory index template
const index_gmi = `# Index of {{ .Permalink }}
{{ range .Dirs }}=> {{ .Permalink }}
{{ end -}}
{{ range .Pages }}=> {{ .Permalink }}
{{ end -}}`
// Default page template
const page_gmi = `# {{ .Title }}
{{ .Content }}`
// 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 }}`