fix(hosting): propagate preview token in nav links + enrich pages with scraped content

Preview token propagation:
- JavaScript in storefront base.html appends _preview query param to
  all internal links when in preview mode, so clicking nav items
  (Services, Contact, etc.) preserves the preview bypass

Scraped content enrichment:
- POC builder now appends first 5 scraped paragraphs to about/services/
  projects pages, so the POC shows actual content from the prospect's
  site instead of just generic template text
- Extracts tagline from second scraped heading

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 19:55:19 +02:00
parent f4386e97ee
commit 91fb4b0757
2 changed files with 36 additions and 2 deletions

View File

@@ -147,8 +147,16 @@ class PocBuilderService:
context["meta_description"] = scraped["meta_description"]
if scraped.get("paragraphs"):
context["about_paragraph"] = scraped["paragraphs"][0]
if scraped.get("headings") and not prospect.business_name:
context["business_name"] = scraped["headings"][0]
# Build rich content from scraped paragraphs for page bodies
context["scraped_paragraphs_html"] = "\n".join(
f"<p>{p}</p>" for p in scraped["paragraphs"][:5]
)
if scraped.get("headings"):
if not prospect.business_name:
context["business_name"] = scraped["headings"][0]
# Use second heading as tagline if available
if len(scraped["headings"]) > 1:
context["tagline"] = scraped["headings"][1]
except (json.JSONDecodeError, KeyError):
pass
@@ -203,6 +211,16 @@ class PocBuilderService:
if content_translations and not content:
content = next(iter(content_translations.values()), "")
# Enrich with scraped paragraphs (append to template content)
scraped_html = context.get("scraped_paragraphs_html", "")
if scraped_html and slug in ("about", "services", "projects"):
content = content + "\n" + scraped_html if content else scraped_html
if content_translations:
for lang_code in content_translations:
content_translations[lang_code] = (
content_translations[lang_code] + "\n" + scraped_html
)
page = ContentPage(
platform_id=platform_id,
store_id=store_id,