feat(seo): add sitemap generator
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/prabhupadasays/spsays-bff/internal/config"
|
||||
"github.com/prabhupadasays/spsays-bff/internal/repository"
|
||||
"github.com/prabhupadasays/spsays-bff/pkg/revalidate"
|
||||
"github.com/typesense/typesense-go/v2/typesense"
|
||||
"github.com/typesense/typesense-go/v2/typesense/api"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
@@ -191,6 +192,15 @@ func main() {
|
||||
}
|
||||
|
||||
sugar.Info("=== Indexing complete ===")
|
||||
|
||||
// Content changed → refresh the frontend sitemap cache (synchronous: this
|
||||
// CLI exits right after, so a background goroutine wouldn't run). No-op
|
||||
// when FRONTEND_URL / REVALIDATE_SECRET are unset.
|
||||
if err := revalidate.New(cfg.FrontendURL, cfg.RevalidateSecret, logger).TriggerSync("sitemap"); err != nil {
|
||||
sugar.Warnf("sitemap revalidation ping failed: %v", err)
|
||||
} else if cfg.RevalidateSecret != "" {
|
||||
sugar.Info("sitemap revalidation pinged")
|
||||
}
|
||||
}
|
||||
|
||||
// importBatch imports documents into Typesense in batches of batchSize.
|
||||
|
||||
Reference in New Issue
Block a user