mirror of https://gitee.com/answerdev/answer.git
feat(seo): response not found page when private mode
This commit is contained in:
parent
392806b146
commit
f288e1f8b7
|
@ -404,10 +404,18 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
|
|||
}
|
||||
|
||||
func (tc *TemplateController) Sitemap(ctx *gin.Context) {
|
||||
if tc.checkPrivateMode(ctx) {
|
||||
tc.Page404(ctx)
|
||||
return
|
||||
}
|
||||
tc.templateRenderController.Sitemap(ctx)
|
||||
}
|
||||
|
||||
func (tc *TemplateController) SitemapPage(ctx *gin.Context) {
|
||||
if tc.checkPrivateMode(ctx) {
|
||||
tc.Page404(ctx)
|
||||
return
|
||||
}
|
||||
page := 0
|
||||
pageParam := ctx.Param("page")
|
||||
pageRegexp := regexp.MustCompile(`question-(.*).xml`)
|
||||
|
@ -427,3 +435,15 @@ func (tc *TemplateController) SitemapPage(ctx *gin.Context) {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (tc *TemplateController) checkPrivateMode(ctx *gin.Context) bool {
|
||||
resp, err := tc.siteInfoService.GetSiteLogin(ctx)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return false
|
||||
}
|
||||
if resp.LoginRequired {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue