MCPcopy Index your code
hub / github.com/TruthHun/BookStack / GetSeoByPage

Method GetSeoByPage

controllers/BaseController.go:290–305  ·  view source on GitHub ↗

根据页面获取seo @param page 页面标识 @param defSeo 默认的seo的map,必须有title、keywords和description字段

(page string, defSeo map[string]string)

Source from the content-addressed store, hash-verified

288// @param page 页面标识
289// @param defSeo 默认的seo的map,必须有title、keywords和description字段
290func (this *BaseController) GetSeoByPage(page string, defSeo map[string]string) {
291 var seo models.Seo
292
293 orm.NewOrm().QueryTable(models.TableSeo).Filter("Page", page).One(&seo)
294 defSeo["sitename"] = this.Sitename
295 if seo.Id > 0 {
296 for k, v := range defSeo {
297 seo.Title = strings.Replace(seo.Title, fmt.Sprintf("{%v}", k), v, -1)
298 seo.Keywords = strings.Replace(seo.Keywords, fmt.Sprintf("{%v}", k), v, -1)
299 seo.Description = strings.Replace(seo.Description, fmt.Sprintf("{%v}", k), v, -1)
300 }
301 }
302 this.Data["SeoTitle"] = seo.Title
303 this.Data["SeoKeywords"] = seo.Keywords
304 this.Data["SeoDescription"] = seo.Description
305}
306
307// 站点地图
308func (this *BaseController) Sitemap() {

Callers 15

IndexMethod · 0.80
CollectionMethod · 0.80
FollowMethod · 0.80
FansMethod · 0.80
IndexMethod · 0.80
indexWithPasswordMethod · 0.80
ReadMethod · 0.80
IndexMethod · 0.80
ListMethod · 0.80
LoginMethod · 0.80
FindPasswordMethod · 0.80
IndexMethod · 0.80

Calls 1

ReplaceMethod · 0.45

Tested by

no test coverage detected