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