feat: links settings and outbound rules in resolve

- migration 202610280003: settings links_new_tab (default on),
  nofollow_domains and sponsored_domains; robots llms_enabled and
  llms_intro (used by the llms.txt commit)
- SEO settings Links tab: the new-tab switch and the two domain lists,
  one domain per line, lowercased, refused with settings.domain_invalid
  naming the line; writable through seo_update_settings
- the resolve answer of an ok page carries outbound {new_tab,
  nofollow_domains, sponsored_domains}; no existing key changes
This commit is contained in:
Jakub Zych
2026-11-04 13:26:31 +01:00
parent 26193ae4eb
commit 49d3879954
11 changed files with 283 additions and 12 deletions

View File

@@ -0,0 +1,37 @@
package updates
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
// addLinksAndLLMS adds the SEO settings' Links tab (links_new_tab, on by
// default; nofollow_domains and sponsored_domains, one domain per line)
// and the robots.txt screen's llms.txt switch (llms_enabled, off by
// default) and introduction (llms_intro).
var addLinksAndLLMS = []*gormigrate.Migration{
{
ID: "202610280003_add_golem15_seo_links_and_llms",
Migrate: func(tx *gorm.DB) error {
if err := tx.Exec(`ALTER TABLE golem15_seo_settings
ADD COLUMN links_new_tab BOOLEAN NOT NULL DEFAULT TRUE,
ADD COLUMN nofollow_domains TEXT NOT NULL DEFAULT '',
ADD COLUMN sponsored_domains TEXT NOT NULL DEFAULT ''`).Error; err != nil {
return err
}
return tx.Exec(`ALTER TABLE golem15_seo_robots
ADD COLUMN llms_enabled BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN llms_intro TEXT NOT NULL DEFAULT ''`).Error
},
Rollback: func(tx *gorm.DB) error {
if err := tx.Exec(`ALTER TABLE golem15_seo_robots DROP COLUMN IF EXISTS llms_enabled, DROP COLUMN IF EXISTS llms_intro`).Error; err != nil {
return err
}
return tx.Exec(`ALTER TABLE golem15_seo_settings DROP COLUMN IF EXISTS links_new_tab, DROP COLUMN IF EXISTS nofollow_domains, DROP COLUMN IF EXISTS sponsored_domains`).Error
},
},
}
func init() {
Register(addLinksAndLLMS...)
}