diff --git a/config.go b/config.go index 2fa28fd..2518c0c 100644 --- a/config.go +++ b/config.go @@ -153,16 +153,17 @@ type configGeoMap struct { } type configContact struct { - Enabled bool `mapstructure:"enabled"` - Path string `mapstructure:"path"` - Title string `mapstructure:"title"` - Description string `mapstructure:"description"` - SMTPHost string `mapstructure:"smtpHost"` - SMTPPort int `mapstructure:"smtpPort"` - SMTPUser string `mapstructure:"smtpUser"` - SMTPPassword string `mapstructure:"smtpPassword"` - EmailFrom string `mapstructure:"emailFrom"` - EmailTo string `mapstructure:"emailTo"` + Enabled bool `mapstructure:"enabled"` + Path string `mapstructure:"path"` + Title string `mapstructure:"title"` + Description string `mapstructure:"description"` + PrivacyPolicy string `mapstructure:"privacyPolicy"` + SMTPHost string `mapstructure:"smtpHost"` + SMTPPort int `mapstructure:"smtpPort"` + SMTPUser string `mapstructure:"smtpUser"` + SMTPPassword string `mapstructure:"smtpPassword"` + EmailFrom string `mapstructure:"emailFrom"` + EmailTo string `mapstructure:"emailTo"` } type configUser struct { diff --git a/contact.go b/contact.go index 0b2d494..7eb4b8b 100644 --- a/contact.go +++ b/contact.go @@ -23,6 +23,7 @@ func (a *goBlog) serveContactForm(w http.ResponseWriter, r *http.Request) { Data: map[string]interface{}{ "title": cc.Title, "description": cc.Description, + "privacy": cc.PrivacyPolicy, }, }) } diff --git a/example-config.yml b/example-config.yml index d1e6d5e..ff9e8d5 100644 --- a/example-config.yml +++ b/example-config.yml @@ -220,9 +220,10 @@ blogs: # Contact form contact: enabled: true # Enable a contact form - title: "Contact me!" # (Optional) Title to show above the form - description: "Feel free to send me a message" # (Optional) Description to show above the form path: /contact # (Optional) Set a custom path (relative to blog path), default is /contact + title: "Contact me!" # (Optional) Title to show above the form + description: "Feel free to send me a message" # (Optional) Description to show above the form, supports markdown + privacyPolicy: "By submitting this form, I agree to the privacy policy." # (Optional) Require agreement to the privacy policy, supports markdown smtpHost: smtp.example.com # SMTP host smtpPort: 587 # (Optional) SMTP port, default is 587 smtpUser: mail@example.com # SMTP user diff --git a/sitemap.go b/sitemap.go index 8ce690c..4d6ecf9 100644 --- a/sitemap.go +++ b/sitemap.go @@ -130,6 +130,12 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) { Loc: a.getFullAddress(bc.getRelativePath(defaultIfEmpty(mc.Path, defaultGeoMapPath))), }) } + // Contact + if cc := bc.Contact; cc != nil && cc.Enabled { + sm.Add(&sitemap.URL{ + Loc: a.getFullAddress(bc.getRelativePath(defaultIfEmpty(cc.Path, defaultContactPath))), + }) + } // Custom pages for _, cp := range bc.CustomPages { sm.Add(&sitemap.URL{ diff --git a/templates/contact.gohtml b/templates/contact.gohtml index b08f506..71a2f48 100644 --- a/templates/contact.gohtml +++ b/templates/contact.gohtml @@ -14,7 +14,12 @@ - + {{ if .Data.privacy }} + {{ md .Data.privacy }} + + {{ else }} + + {{ end }} {{ end }} diff --git a/templates/strings/de.yaml b/templates/strings/de.yaml index 69182eb..ed9ac17 100644 --- a/templates/strings/de.yaml +++ b/templates/strings/de.yaml @@ -5,6 +5,7 @@ comments: "Kommentare" confirmdelete: "Löschen bestätigen" connectedviator: "Verbunden über Tor." connectviator: "Über Tor verbinden." +contactagreesend: "Akzeptieren & Senden" contactsend: "Senden" create: "Erstellen" delete: "Löschen" diff --git a/templates/strings/default.yaml b/templates/strings/default.yaml index 0aa9959..fa7170c 100644 --- a/templates/strings/default.yaml +++ b/templates/strings/default.yaml @@ -10,6 +10,7 @@ comments: "Comments" confirmdelete: "Confirm deletion" connectedviator: "Connected via Tor." connectviator: "Connect via Tor." +contactagreesend: "Accept & Send" contactsend: "Send" create: "Create" delete: "Delete"