Files
mono/market/sx/meta.sx
giles e81d77437e Move market composition from Python to .sx defcomps (Phase 3)
Python sxc/pages/ functions no longer build nested sx_call chains or
reference leaf component names. Instead they extract data (URLs, prices,
CSRF, cart state) and call a single top-level composition defcomp with
pure data values. The .sx defcomps handle all component-to-component
wiring, iteration (map), and conditional rendering.

New .sx composition defcomps:
- headers.sx: ~market-header-from-data, ~market-desktop-nav-from-data,
  ~market-product-header-from-data, ~market-product-admin-header-from-data
- prices.sx: ~market-prices-header-from-data, ~market-card-price-from-data
- navigation.sx: ~market-mobile-nav-from-data
- cards.sx: ~market-product-cards-content, ~market-card-from-data,
  ~market-cards-content, ~market-landing-from-data
- detail.sx: ~market-product-detail-from-data, ~market-detail-gallery-from-data,
  ~market-detail-info-from-data
- meta.sx: ~market-product-meta-from-data
- filters.sx: ~market-desktop-filter-from-data, ~market-mobile-chips-from-data,
  ~market-mobile-filter-content-from-data, plus 6 sub-composition defcomps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 01:11:57 +00:00

52 lines
2.2 KiB
Plaintext

;; Market meta/SEO components
(defcomp ~market-meta-title (&key title)
(title title))
(defcomp ~market-meta-description (&key description)
(meta :name "description" :content description))
(defcomp ~market-meta-canonical (&key href)
(link :rel "canonical" :href href))
(defcomp ~market-meta-og (&key property content)
(meta :property property :content content))
(defcomp ~market-meta-twitter (&key name content)
(meta :name name :content content))
(defcomp ~market-meta-jsonld (&key json)
(script :type "application/ld+json" (~rich-text :html json)))
;; ---------------------------------------------------------------------------
;; Composition: all product meta tags from data
;; ---------------------------------------------------------------------------
(defcomp ~market-product-meta-from-data (&key title description canonical image-url
site-title brand price price-currency
jsonld-json)
(<>
(~market-meta-title :title title)
(~market-meta-description :description description)
(when canonical (~market-meta-canonical :href canonical))
;; OpenGraph
(~market-meta-og :property "og:site_name" :content site-title)
(~market-meta-og :property "og:type" :content "product")
(~market-meta-og :property "og:title" :content title)
(~market-meta-og :property "og:description" :content description)
(when canonical (~market-meta-og :property "og:url" :content canonical))
(when image-url (~market-meta-og :property "og:image" :content image-url))
(when (and price price-currency)
(<> (~market-meta-og :property "product:price:amount" :content price)
(~market-meta-og :property "product:price:currency" :content price-currency)))
(when brand (~market-meta-og :property "product:brand" :content brand))
;; Twitter
(~market-meta-twitter :name "twitter:card"
:content (if image-url "summary_large_image" "summary"))
(~market-meta-twitter :name "twitter:title" :content title)
(~market-meta-twitter :name "twitter:description" :content description)
(when image-url (~market-meta-twitter :name "twitter:image" :content image-url))
;; JSON-LD
(~market-meta-jsonld :json jsonld-json)))