feat: auto-link phrases in the resolve answer (tracer)
- golem15_seo_autolinks (migration 202610280007) and the settings column autolink_max (Links tab, 0 to 20, default 3) - classes/autolinks.go: checked save and delete with history, ForPage - ok resolve answers carry autolinks for the page's locale without disabled phrases and links to the page itself, and autolink_max
This commit is contained in:
@@ -67,6 +67,12 @@ type Result struct {
|
||||
// Outbound is how the layer renders links to other sites (P33-16),
|
||||
// present on ok answers.
|
||||
Outbound *Outbound `json:"outbound,omitempty"`
|
||||
// Autolinks are the auto-link phrases of the page's locale without
|
||||
// those linking to the page itself, longest first, and AutolinkMax the
|
||||
// most the layer links in one text (D-82); present on ok answers, no
|
||||
// phrases when AutolinkMax is 0.
|
||||
Autolinks []AutolinkLink `json:"autolinks,omitempty"`
|
||||
AutolinkMax *int `json:"autolink_max,omitempty"`
|
||||
// HTMLLang is the page's <html lang> (P33-21); Alternates its hreflang
|
||||
// list, the page itself and x-default included (D-55 to D-57); JSONLD
|
||||
// its one @graph (D-43); Breadcrumbs its trail, the same items as the
|
||||
@@ -799,8 +805,15 @@ func (r *Resolver) resolveAt(ctx context.Context, db *gorm.DB, settings models.S
|
||||
res.Action, res.Status, res.Locale, res.SEO = ActionOK, 200, locale, seo
|
||||
res.Outbound = OutboundOf(settings)
|
||||
// The sitemap filter (production) decides on robots and canonical
|
||||
// only; it skips the structured data.
|
||||
// only; it skips the auto-links and the structured data.
|
||||
if !r.production {
|
||||
most := min(models.MaxAutolinkMax, max(models.MinAutolinkMax, settings.AutolinkMax))
|
||||
res.AutolinkMax = &most
|
||||
if most > 0 {
|
||||
if res.Autolinks, err = svc.ForPage(ctx, db, locale, path); err != nil {
|
||||
return Result{}, err
|
||||
}
|
||||
}
|
||||
if err := svc.structuredData(ctx, db, settings, &res, structuredIn{
|
||||
key: key, id: res.RecordID, rec: rec, entry: entry, content: content,
|
||||
locale: locale, path: path, url: self, home: home, siteName: svc.SiteName(ctx, settings, locale), seo: seo,
|
||||
|
||||
Reference in New Issue
Block a user