fix(cms): storefront renders sections for landing pages + fix nav URLs
Two critical fixes for POC site rendering: 1. Storefront content page route now selects template based on page.template field: 'full' → landing-full.html (section-based), 'modern'/'minimal' → their respective templates. Default stays content-page.html (plain HTML). Previously always used content-page which ignores page.sections JSON. 2. Storefront base_url uses store.subdomain (lowercase, hyphens) instead of store.store_code (uppercase, underscores) for URL building. Nav links now point to correct paths that the store context middleware can resolve. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -384,15 +384,17 @@ def get_storefront_context(
|
||||
if access_method == "path" and store:
|
||||
platform = getattr(request.state, "platform", None)
|
||||
platform_original_path = getattr(request.state, "platform_original_path", None)
|
||||
# Use subdomain (lowercase, hyphens) for URL routing — store_code is for internal use
|
||||
store_slug = store.subdomain or store.store_code
|
||||
if platform and platform_original_path and platform_original_path.startswith("/platforms/"):
|
||||
base_url = f"/platforms/{platform.code}/storefront/{store.store_code}/"
|
||||
base_url = f"/platforms/{platform.code}/storefront/{store_slug}/"
|
||||
else:
|
||||
full_prefix = (
|
||||
store_context.get("full_prefix", "/storefront/")
|
||||
if store_context
|
||||
else "/storefront/"
|
||||
)
|
||||
base_url = f"{full_prefix}{store.store_code}/"
|
||||
base_url = f"{full_prefix}{store_slug}/"
|
||||
|
||||
# Read subscription info set by StorefrontAccessMiddleware
|
||||
subscription = getattr(request.state, "subscription", None)
|
||||
|
||||
Reference in New Issue
Block a user