func registerFunctions(res *admin.Resource) { res.GetAdmin().RegisterFuncMap("filter_default_var_sections", func(sections []*admin.Section) []*admin.Section { var filterDefaultVarSections []*admin.Section for _, section := range sections { isContainSeoTag := false for _, row := range section.Rows { for _, col := range row { meta := res.GetMetaOrNew(col) if meta != nil && meta.Type == "seo" { isContainSeoTag = true } } } if !isContainSeoTag { filterDefaultVarSections = append(filterDefaultVarSections, section) } } return filterDefaultVarSections }) res.GetAdmin().RegisterFuncMap("filter_page_sections", func(sections []*admin.Section) []*admin.Section { var filterPageSections []*admin.Section for _, section := range sections { isContainSeoTag := false for _, row := range section.Rows { for _, col := range row { meta := res.GetMetaOrNew(col) if meta != nil && meta.Type == "seo" { isContainSeoTag = true } } } if isContainSeoTag { filterPageSections = append(filterPageSections, section) } } return filterPageSections }) }