feat: sitemap filter excludes noindex, canonicalised and redirected URLs (tracer)

- classes.SitemapFilter implements the sitemap plugin's contract.Filter on
  the production values: redirected, noindex and canonicalised addresses
  leave the sitemaps with their reason; staging lists the same set
- the plugin requires golem15.sitemap and publishes the filter in Register
- go.mod requires sm-sitemap-plugin, go.work mounts the sibling checkout
This commit is contained in:
Jakub Zych
2026-11-04 13:02:39 +01:00
parent 55f5e5dbb0
commit 17b810dfde
8 changed files with 286 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import (
"net/http/httptest"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"sync"
@@ -21,6 +22,7 @@ import (
"time"
seo "git.golem15.com/golem15/sm-seo-plugin"
_ "git.golem15.com/golem15/sm-sitemap-plugin"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/bouncer"
"git.golem15.com/golem15/summercms/modules/cabana"
@@ -328,9 +330,13 @@ func bootEnv(t *testing.T, extraEnv ...string) *testEnv {
return bootPlugins(t, []string{"acme.pages", "golem15.seo"}, extraEnv...)
}
// bootPlugins boots the plugins ids on a fresh database.
// bootPlugins boots the plugins ids on a fresh database. golem15.seo
// requires golem15.sitemap, so the sitemap plugin is booted with it.
func bootPlugins(t *testing.T, ids []string, extraEnv ...string) *testEnv {
t.Helper()
if slices.Contains(ids, "golem15.seo") && !slices.Contains(ids, seo.SitemapPluginID) {
ids = append([]string{seo.SitemapPluginID}, ids...)
}
sqlDB := freshDB(t)
gdb, err := lagoon.Use(t.Context(), sqlDB)
if err != nil {