mirror of https://github.com/jlelse/GoBlog
Contact: Add option for privacy policy
This commit is contained in:
parent
bdbaf9b915
commit
3db1f6b85c
21
config.go
21
config.go
|
@ -153,16 +153,17 @@ type configGeoMap struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type configContact struct {
|
type configContact struct {
|
||||||
Enabled bool `mapstructure:"enabled"`
|
Enabled bool `mapstructure:"enabled"`
|
||||||
Path string `mapstructure:"path"`
|
Path string `mapstructure:"path"`
|
||||||
Title string `mapstructure:"title"`
|
Title string `mapstructure:"title"`
|
||||||
Description string `mapstructure:"description"`
|
Description string `mapstructure:"description"`
|
||||||
SMTPHost string `mapstructure:"smtpHost"`
|
PrivacyPolicy string `mapstructure:"privacyPolicy"`
|
||||||
SMTPPort int `mapstructure:"smtpPort"`
|
SMTPHost string `mapstructure:"smtpHost"`
|
||||||
SMTPUser string `mapstructure:"smtpUser"`
|
SMTPPort int `mapstructure:"smtpPort"`
|
||||||
SMTPPassword string `mapstructure:"smtpPassword"`
|
SMTPUser string `mapstructure:"smtpUser"`
|
||||||
EmailFrom string `mapstructure:"emailFrom"`
|
SMTPPassword string `mapstructure:"smtpPassword"`
|
||||||
EmailTo string `mapstructure:"emailTo"`
|
EmailFrom string `mapstructure:"emailFrom"`
|
||||||
|
EmailTo string `mapstructure:"emailTo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type configUser struct {
|
type configUser struct {
|
||||||
|
|
|
@ -23,6 +23,7 @@ func (a *goBlog) serveContactForm(w http.ResponseWriter, r *http.Request) {
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"title": cc.Title,
|
"title": cc.Title,
|
||||||
"description": cc.Description,
|
"description": cc.Description,
|
||||||
|
"privacy": cc.PrivacyPolicy,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,9 +220,10 @@ blogs:
|
||||||
# Contact form
|
# Contact form
|
||||||
contact:
|
contact:
|
||||||
enabled: true # Enable a contact form
|
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
|
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
|
smtpHost: smtp.example.com # SMTP host
|
||||||
smtpPort: 587 # (Optional) SMTP port, default is 587
|
smtpPort: 587 # (Optional) SMTP port, default is 587
|
||||||
smtpUser: mail@example.com # SMTP user
|
smtpUser: mail@example.com # SMTP user
|
||||||
|
|
|
@ -130,6 +130,12 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
|
||||||
Loc: a.getFullAddress(bc.getRelativePath(defaultIfEmpty(mc.Path, defaultGeoMapPath))),
|
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
|
// Custom pages
|
||||||
for _, cp := range bc.CustomPages {
|
for _, cp := range bc.CustomPages {
|
||||||
sm.Add(&sitemap.URL{
|
sm.Add(&sitemap.URL{
|
||||||
|
|
|
@ -14,7 +14,12 @@
|
||||||
<input type="url" name="website" placeholder="{{ string .Blog.Lang "websiteopt" }}">
|
<input type="url" name="website" placeholder="{{ string .Blog.Lang "websiteopt" }}">
|
||||||
<input type="email" name="email" placeholder="{{ string .Blog.Lang "emailopt" }}">
|
<input type="email" name="email" placeholder="{{ string .Blog.Lang "emailopt" }}">
|
||||||
<textarea name="message" required placeholder="{{ string .Blog.Lang "message" }}"></textarea>
|
<textarea name="message" required placeholder="{{ string .Blog.Lang "message" }}"></textarea>
|
||||||
<input type="submit" value="{{ string .Blog.Lang "contactsend" }}">
|
{{ if .Data.privacy }}
|
||||||
|
{{ md .Data.privacy }}
|
||||||
|
<input type="submit" value="{{ string .Blog.Lang "contactagreesend" }}">
|
||||||
|
{{ else }}
|
||||||
|
<input type="submit" value="{{ string .Blog.Lang "contactsend" }}">
|
||||||
|
{{ end }}
|
||||||
</form>
|
</form>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -5,6 +5,7 @@ comments: "Kommentare"
|
||||||
confirmdelete: "Löschen bestätigen"
|
confirmdelete: "Löschen bestätigen"
|
||||||
connectedviator: "Verbunden über Tor."
|
connectedviator: "Verbunden über Tor."
|
||||||
connectviator: "Über Tor verbinden."
|
connectviator: "Über Tor verbinden."
|
||||||
|
contactagreesend: "Akzeptieren & Senden"
|
||||||
contactsend: "Senden"
|
contactsend: "Senden"
|
||||||
create: "Erstellen"
|
create: "Erstellen"
|
||||||
delete: "Löschen"
|
delete: "Löschen"
|
||||||
|
|
|
@ -10,6 +10,7 @@ comments: "Comments"
|
||||||
confirmdelete: "Confirm deletion"
|
confirmdelete: "Confirm deletion"
|
||||||
connectedviator: "Connected via Tor."
|
connectedviator: "Connected via Tor."
|
||||||
connectviator: "Connect via Tor."
|
connectviator: "Connect via Tor."
|
||||||
|
contactagreesend: "Accept & Send"
|
||||||
contactsend: "Send"
|
contactsend: "Send"
|
||||||
create: "Create"
|
create: "Create"
|
||||||
delete: "Delete"
|
delete: "Delete"
|
||||||
|
|
Loading…
Reference in New Issue