|
@@ -65,3 +65,23 @@ func (this *Modules) RegisterModule_Settings() *Module {
|
|
return this.getSidebarModules(wrap), content, sidebar
|
|
return this.getSidebarModules(wrap), content, sidebar
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func (this *Modules) RegisterAction_SettingsRobotsTxt() *Action {
|
|
|
|
+ return this.newAction(AInfo{
|
|
|
|
+ WantDB: true,
|
|
|
|
+ Mount: "settings-robots-txt",
|
|
|
|
+ WantAdmin: true,
|
|
|
|
+ }, func(wrap *wrapper.Wrapper) {
|
|
|
|
+ pf_content := wrap.R.FormValue("content")
|
|
|
|
+
|
|
|
|
+ // Save robots.txt content
|
|
|
|
+ err := ioutil.WriteFile(wrap.DTemplate+string(os.PathSeparator)+"robots.txt", []byte(pf_content), 0664)
|
|
|
|
+ if err != nil {
|
|
|
|
+ wrap.MsgError(err.Error())
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Reload current page
|
|
|
|
+ wrap.Write(`window.location.reload(false);`)
|
|
|
|
+ })
|
|
|
|
+}
|