Phase 1, part 4: promote the company's own products

- Content lists the company first, at /content/own: its products from
  the profile (always there to pick from), its own feeds (a new profile
  field for the blog, news and releases), and new or updated pages from
  its websites' sitemaps, with each page's title and description.
- Drafts from it are kind "product" (utm_campaign=product), filed under
  the company's name, and prompted to promote the company's own work
  without unsupported claims; on Reddit, in the makers' voice, with a
  warning that self-promotion is often restricted.

This completes Phase 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 14:42:37 -07:00
co-authored by Claude Opus 5.5
parent 0e34f574b7
commit cd24f2a06d
20 changed files with 685 additions and 30 deletions
+29
View File
@@ -11,6 +11,7 @@ import (
"time"
"supermarket/internal/api/rss"
"supermarket/internal/api/sitemap"
"supermarket/internal/api/twitter"
"supermarket/internal/api/youtube"
"supermarket/internal/inventory"
@@ -22,6 +23,10 @@ type Fetcher struct {
Twitter *twitter.Client
YouTube *youtube.Client
RSS *rss.Client
// Sitemap, if set, also reads new pages from the entry's websites'
// sitemaps. It's set for the company's own content only: a partner's
// every page change isn't news.
Sitemap *sitemap.Client
}
// Result is what a fetch found, and what failed or was skipped.
@@ -78,6 +83,27 @@ func (f *Fetcher) Fetch(ctx context.Context, e *inventory.Entry, since time.Time
}
}
if f.Sitemap != nil {
for _, site := range e.Websites {
site := site
jobs = append(jobs, job{"sitemap " + site, func() ([]models.ContentItem, error) {
pages, err := f.Sitemap.NewPages(ctx, site, since)
if err != nil {
return nil, err
}
var items []models.ContentItem
for _, pg := range pages {
it, err := f.Sitemap.Item(ctx, pg, e.Name)
if err != nil {
continue // one unreadable page doesn't spoil the rest
}
items = append(items, it)
}
return items, nil
}})
}
}
type batch struct {
label string
items []models.ContentItem
@@ -126,6 +152,9 @@ func Sources(e *inventory.Entry) []string {
if e.YouTubeChannelID != "" {
out = append(out, "YouTube")
}
if e.Relationship == "product" && len(e.Websites) > 0 {
out = append(out, "new pages on your websites")
}
if n := len(e.RSS); n == 1 {
out = append(out, "1 RSS feed")
} else if n > 1 {