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

+22
View File
@@ -0,0 +1,22 @@
package site
import "strings"
func (s Site) PublicURL(lang string, slug string) *string {
if s.PublicURLPattern == nil || lang == "" {
return nil
}
filled := strings.NewReplacer(LangPlaceholder, lang, SlugPlaceholder, slug).Replace(*s.PublicURLPattern)
return &filled
}
func (s Site) ArticleURL(lang string, slug string) (string, bool) {
if localized := s.PublicURL(lang, slug); localized != nil {
return *localized, true
}
return s.LegacyURL(slug), false
}
func (s Site) LegacyURL(slug string) string {
return s.BaseURL + "/" + slug
}