From 91fb4b0757a1bc9da4ff1a9b367c3a0a048666b7 Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Fri, 3 Apr 2026 19:55:19 +0200 Subject: [PATCH] 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) --- .../hosting/services/poc_builder_service.py | 22 +++++++++++++++++-- app/templates/storefront/base.html | 16 ++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/modules/hosting/services/poc_builder_service.py b/app/modules/hosting/services/poc_builder_service.py index 8c154baf..6ba9e95e 100644 --- a/app/modules/hosting/services/poc_builder_service.py +++ b/app/modules/hosting/services/poc_builder_service.py @@ -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}

" 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, diff --git a/app/templates/storefront/base.html b/app/templates/storefront/base.html index e3f51e02..686556e7 100644 --- a/app/templates/storefront/base.html +++ b/app/templates/storefront/base.html @@ -220,6 +220,22 @@ hostwizard.lu + {% endif %} {# Mobile menu panel #}