1
0
Fork 0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-05-10 00:06:06 +02:00
kiln/templates.go

43 lines
1.1 KiB
Go
Raw Normal View History

2020-09-29 22:42:27 +02:00
package main
2020-10-01 03:57:59 +02:00
// Default atom feed template
2020-09-29 22:42:27 +02: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 03:30:50 +02:00
<link href="{{ .URL }}"/>
<link rel="self" href="{{ .URL }}{{ .Path }}"/>
2020-09-30 06:27:59 +02:00
<updated>{{ .Updated.Format "2006-01-02T15:04:05Z07:00" }}</updated>
2020-09-30 03:30:50 +02:00
<id>{{ .URL }}{{ .Path }}</id>
{{- $url := .URL -}}
{{- range .Entries }}
2020-09-29 22:42:27 +02:00
<entry>
<title>{{ .Title }}</title>
2020-09-30 03:30:50 +02:00
<link href="{{ $url }}{{ .Permalink }}"/>
<id>{{ $url }}{{ .Permalink }}</id>
2020-09-29 22:42:27 +02:00
<updated>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
2020-09-30 03:30:50 +02:00
<content src="{{ $url }}{{ .Permalink }}" type="text/gemini"></content>
2020-09-29 22:42:27 +02:00
</entry>
2020-09-30 03:30:50 +02:00
{{ end -}}
2020-09-29 22:42:27 +02:00
</feed>`
2020-10-01 03:57:59 +02:00
// Default directory index template
2020-09-29 22:42:27 +02:00
const index_gmi = `# Index of {{ .Permalink }}
2020-09-30 03:30:50 +02:00
{{ range .Dirs }}=> {{ .Permalink }}
{{ end -}}
2020-09-29 22:42:27 +02:00
{{ range .Pages }}=> {{ .Permalink }}
2020-09-30 03:30:50 +02:00
{{ end -}}`
2020-09-29 22:42:27 +02:00
2020-10-01 03:57:59 +02:00
// Default page template
2020-09-29 22:42:27 +02:00
const page_gmi = `# {{ .Title }}
{{ .Content }}`
2020-10-01 03:57:59 +02: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 }}`