54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package article
|
|
|
|
const (
|
|
SEOStatusReady = "ready"
|
|
SEOStatusSuggestions = "suggestions"
|
|
SEOStatusHidden = "hidden"
|
|
|
|
SEOTitleMaxRunes = 60
|
|
SEODescriptionMinRunes = 70
|
|
SEODescriptionMaxRunes = 160
|
|
SEOSlugMaxRunes = 75
|
|
SEOHeadingMinTextRunes = 1000
|
|
SEOShortBodyRunes = 300
|
|
|
|
SEOFieldTitle = "seo_title"
|
|
SEOFieldDescription = "seo_description"
|
|
SEOFieldCoverAlt = "cover_image_alt"
|
|
SEOFieldCoverID = "cover_image_id"
|
|
SEOFieldSlug = "slug"
|
|
SEOFieldAuthors = "author_ids"
|
|
SEOFieldBody = "body"
|
|
)
|
|
|
|
type SEOSuggestion struct {
|
|
Code string `json:"code"`
|
|
Field string `json:"field"`
|
|
Params map[string]int `json:"params"`
|
|
}
|
|
|
|
type SEOAssessment struct {
|
|
Status string `json:"status"`
|
|
Suggestions []SEOSuggestion `json:"suggestions"`
|
|
}
|
|
|
|
type SEOSummary struct {
|
|
Status string
|
|
Suggestions int
|
|
}
|
|
|
|
func (a SEOAssessment) Summary() SEOSummary {
|
|
return SEOSummary{Status: a.Status, Suggestions: len(a.Suggestions)}
|
|
}
|
|
|
|
type SEOSlugCheck struct {
|
|
Available bool `json:"available"`
|
|
Suggestion *string `json:"suggestion"`
|
|
}
|
|
|
|
type SEOCheck struct {
|
|
Status string `json:"status"`
|
|
Suggestions []SEOSuggestion `json:"suggestions"`
|
|
Slug SEOSlugCheck `json:"slug"`
|
|
}
|