diff --git a/config.go b/config.go
index cd0791e..15c9ce9 100644
--- a/config.go
+++ b/config.go
@@ -10,7 +10,7 @@ import (
// Config contains site configuration.
type Config struct {
Title string // site title
- URL string // site URL
+ URLs []string // site URLs
Feeds map[string]string // site feeds
Templates *Templates // site templates
}
@@ -37,7 +37,7 @@ func (c *Config) Load(path string) error {
case "title":
c.Title = value
case "url":
- c.URL = value
+ c.URLs = append(c.URLs, value)
}
case "feeds":
c.Feeds[key] = value
@@ -50,7 +50,7 @@ func (c *Config) LoadTemplates(path string) error {
// Site contains site metadata passed to templates
type Site struct {
Title string
- URL string
+ URLs []string
}
// Load templates
@@ -59,7 +59,7 @@ func (c *Config) LoadTemplates(path string) error {
"site": func() Site {
return Site{
Title: c.Title,
- URL: c.URL,
+ URLs: c.URLs,
}
},
})
diff --git a/doc/kiln.1.scd b/doc/kiln.1.scd
index 7d2f088..ed7e53d 100644
--- a/doc/kiln.1.scd
+++ b/doc/kiln.1.scd
@@ -164,7 +164,12 @@ The following keys are supported:
| title
: Site title
| url
-: Site URL. Should not end with a trailing slash.
+: Site URL.
+
+Site URLs are only used when generating Atom feeds.
+Site URLs should not end with a trailing slash.
+More than one site URL may be specified by specifying multiple url keys.
+This allows a site that is hosted on both Gemini and HTTP to specify URLs for both locations.
The following sections are supported:
diff --git a/templates.go b/templates.go
index 117114f..b87217d 100644
--- a/templates.go
+++ b/templates.go
@@ -99,15 +99,18 @@ const output_html = `
// Default atom feed template
const atom_xml = `
-{{ site.URL }}{{ .Path }}
+{{ index site.URLs 0 }}{{ .Path }}
{{ .Title }}
{{ .Updated.Format "2006-01-02T15:04:05Z07:00" }}
-
+
{{ range .Entries }}
- {{ site.URL }}{{ .Path }}
+ {{ index site.URLs 0 }}{{ .Path }}
{{ .Title }}
{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}
-
+ {{- $path := .Path }}
+ {{- range site.URLs }}
+
+ {{- end }}
{{ end -}}
`
diff --git a/templates/atom.xml b/templates/atom.xml
index 5aad2e4..be9a6d2 100644
--- a/templates/atom.xml
+++ b/templates/atom.xml
@@ -1,14 +1,17 @@
-{{ site.URL }}{{ .Path }}
+{{ index site.URLs 0 }}{{ .Path }}
{{ .Title }}
{{ .Updated.Format "2006-01-02T15:04:05Z07:00" }}
-
+
{{ range .Entries }}
- {{ site.URL }}{{ .Path }}
+ {{ index site.URLs 0 }}{{ .Path }}
{{ .Title }}
{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}
-
+ {{- $path := .Path }}
+ {{- range site.URLs }}
+
+ {{- end }}
{{ end -}}