hotdog-cms import fourthwall brings a Fourthwall shop's public products
in as shop pack pages, with the storefront token from
HOTDOG_FOURTHWALL_TOKEN: description and details as Markdown, photos
brought into the site, sizes and colors as variants, collections as
terms of a taxonomy. It's run again whenever the shop changes: products
are matched by id, unchanged pages and photos are left alone, front
matter the site added is kept, and products that left the shop are
listed (deleted with -prune).
The shop pack (1.2.0) takes variants: each with a price and a buy link,
or, when the product has a checkout form (Fourthwall's reads the choice
from its address), a size picker whose Buy now goes straight to the
checkout. Both work without a script. Prices that vary show "From", and
search engines get an AggregateOffer.
cart: true in site.yaml turns on a cart: HotDog's cart script, kept in
the visitor's browser and sent nowhere until checkout, which opens the
shop's checkout with every item (id:quantity, joined). Product pages get
Add to cart beside Buy now; the cart page (layout: cart) lists, changes
and removes items and suggests other products, those sharing a tag
first. Themes put {{ cart }} in the head and {{ cartLink }} in the
header, as the starter now does, and the privacy notice says where the
cart is kept.
17 lines
995 B
HTML
17 lines
995 B
HTML
{{ define "main" }}
|
|
<link rel="stylesheet" href="{{ asset "packs/shop/shop.css" }}">
|
|
{{ $c := default "products" .Params.collection }}{{ $shop := "" }}{{ with index .Site.Lists $c }}{{ $shop = .Path }}{{ end }}
|
|
<section class="wrap page cart-page">
|
|
<h1>{{ .Title }}</h1>
|
|
{{ with .Content }}<div class="prose">{{ . }}</div>{{ end }}
|
|
<div class="cart-view" data-cart-view{{ with $shop }} data-shop="{{ . }}"{{ end }}>
|
|
{{ if cartOn }}<p class="cart-empty">The cart needs JavaScript. Without it, choose Buy now on a product to check out with just that one.</p>
|
|
{{ else }}<p>The cart is off: turn it on with <code>cart: true</code> in site.yaml.</p>{{ end }}
|
|
</div>
|
|
<section class="cart-suggest" data-cart-suggest data-count="{{ default 4 .Params.suggest }}" hidden>
|
|
<h2>{{ default "You might also like" .Params.suggest_heading }}</h2>
|
|
<ul class="shop-grid">{{ range limit 48 (collection $c) }}{{ template "product-card" . }}{{ end }}</ul>
|
|
</section>
|
|
</section>
|
|
{{ end }}
|