update product data format & extension

Tom Rutgers committed Aug 17, 2018
commit 9d93563ce81664c3a2b1b1c3771ae585531c9bcc
Showing 3 changed files with 26 additions and 12 deletions
data/products/coffea-liberica.md +0 -11
@@ @@ -1,11 +0,0 @@
- ---
- title: Coffea Liberica
- date: 2018-08-17T22:00:17.966Z
- image: /images/uploads/product-01.jpg
- weight:
- amount: '0.5'
- price: '18'
- ---
- The Coffea liberica tree grows up to 20 metres in height, producing larger fruits than those found on Coffea arabica trees. This coffee was brought to Indonesia to replace the arabica trees killed by the coffee rust disease at the end of the 19th century. It is still found in parts of Central and East Java today.
-
- Liberica is a small crop in the Philippines. The city of Lipa in the province of Batangas province became the country's biggest producer of arabica in the 1880s until the industry collapsed due, as with Indonesia above, to the coffee rust of the 1890s, killing almost all Coffea arabica plants in the area and threatening the variety with extinction. Today, Batangas and the neighboring province of Cavite are producers of a variety of liberica known as barako.
source/admin/config.yml +8 -1
@@ @@ -23,6 +23,7 @@ collections:
#yaml middleman data example
- name: product
label: Product
+ format: yml
extension: yml
folder: data/products/
create: true
@@ @@ -39,7 +40,13 @@ collections:
- {label: Amount, name: amount, widget: number}
- {label: Unit, name: unit, widget: select, options: ['kg', 'pound', 'stone'], default: 'kg'}
- - {label: Price, name: price, widget: number}
+ - label: Price
+ name: price
+ widget: object
+ fields:
+ - {label: Amount, name: amount, widget: number}
+ - {label: Currency, name: currency, widget: select, options: ['€', '$', '£'], default: '€'}
+
- {label: Body, name: body, widget: markdown}
- name: pages
source/partials/homepage/_products.slim +18 -0
@@ @@ -0,0 +1,18 @@
+ .homepage-products
+ .container
+ .row
+ - data.products.each do | product |
+ .product
+ .product-image
+ = image_tag product.image
+ .product-content
+ .title
+ h2 = product.title
+ .weight
+ p
+ = product.weight.amount
+ |
+ = product.weight.unit
+
+ .price
+ = product.price
\ No newline at end of file