mirror of https://github.com/go-sonic/sonic.git
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.
35 lines
887 B
Go
35 lines
887 B
Go
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")
|
|
}
|