feat: public API, SEO and existing surfaces

This commit is contained in:
Florian Sylvain committed 2026-11-03 03:58:10 +01:00
1 parent 45fbbc33b1
commit c390fcfe8d
103 files changed
+4476 -231

No files matched your search

+5 -3
View File
@@ -15,7 +15,9 @@ func metaTitle(art article.Article) (string, string) {
return art.Title, article.SEOSourceTitle
}
func resolveDescription(art article.Article, owner site.Site, facts bodyFacts) (string, string) {
const withSiteText = true
func resolveDescription(art article.Article, owner site.Site, facts bodyFacts, siteTextAllowed bool) (string, string) {
if art.SEODescription != "" {
return art.SEODescription, article.SEOSourceSEODescription
}
@@ -25,7 +27,7 @@ func resolveDescription(art article.Article, owner site.Site, facts bodyFacts) (
if sentence := firstSentence(facts.spacedText); sentence != "" {
return sentence, article.SEOSourceBody
}
if owner.DefaultDescription != "" {
if siteTextAllowed && owner.DefaultDescription != "" {
return owner.DefaultDescription, article.SEOSourceSite
}
return "", article.SEOSourceNone
@@ -45,7 +47,7 @@ func rawSuggestions(art article.Article, owner site.Site, facts bodyFacts) []art
if strings.TrimSpace(title) == "" {
suggestions = append(suggestions, suggestion(article.DismissTitleEmpty, article.SEOFieldTitle, map[string]int{}))
}
description, _ := resolveDescription(art, owner, facts)
description, _ := resolveDescription(art, owner, facts, withSiteText)
descriptionRunes := utf8.RuneCountInString(description)
if descriptionRunes < article.SEODescriptionMinRunes {
suggestions = append(suggestions, suggestion(article.DismissDescShort, article.SEOFieldDescription, map[string]int{"length": descriptionRunes, "min": article.SEODescriptionMinRunes}))