You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sonic/handler/content/model/link.go

35 lines
887 B
Go

2 years ago
package model
import (
"context"
"github.com/go-sonic/sonic/model/property"
"github.com/go-sonic/sonic/service"
"github.com/go-sonic/sonic/template"
)
func NewLinkModel(
optionService service.OptionService,
themeService service.ThemeService,
linkService service.LinkService,
) *LinkModel {
return &LinkModel{
OptionService: optionService,
ThemeService: themeService,
LinkService: linkService,
}
}
type LinkModel struct {
LinkService service.LinkService
OptionService service.OptionService
ThemeService service.ThemeService
}
func (l *LinkModel) Links(ctx context.Context, model template.Model) (string, error) {
model["is_links"] = true
model["meta_keywords"] = l.OptionService.GetOrByDefault(ctx, property.SeoKeywords)
model["meta_description"] = l.OptionService.GetOrByDefault(ctx, property.SeoDescription)
return l.ThemeService.Render(ctx, "links")
}