From 988a3cd185b9e0268ad220b6f506acf446a35447 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Tue, 21 Feb 2017 00:50:28 -0800 Subject: Make product page use content from frontmatter --- site/content/products.md | 65 ++++++++++++++++++++++++++++++--- site/layouts/partials/4-up.html | 33 +++-------------- site/layouts/partials/blockquote.html | 4 +- site/layouts/partials/head.html | 2 +- site/layouts/partials/image-grid.html | 6 +-- site/layouts/partials/table-column.html | 11 ++---- site/layouts/partials/table.html | 17 ++------- site/layouts/products/single.html | 21 ++++++----- site/static/admin/config.yml | 21 ++++++++++- 9 files changed, 111 insertions(+), 69 deletions(-) diff --git a/site/content/products.md b/site/content/products.md index 4641457..efcfe04 100644 --- a/site/content/products.md +++ b/site/content/products.md @@ -1,5 +1,60 @@ -+++ -title = "Products" -type = "products" -page="/products.html" -+++ +--- +title: "Products" +type: "products" +image: "/img/products/jumbotron.jpg" +page: "/products.html" +heading: "What we offer" +description: "Kaldi is the ultimate spot for coffee lovers who want to learn about their java’s origin and support the farmers that grew it. We take coffee production, roasting and brewing seriously and we’re glad to pass that knowledge to anyone." +intro: + heading: "What we offer" + description: | + Kaldi is the ultimate spot for coffee lovers who want to learn about their java’s origin and support the farmers that grew it. We take coffee production, roasting and brewing seriously and we’re glad to pass that knowledge to anyone. + blurbs: + - image: "/img/illustrations/coffee.svg" + text: | + We sell green and roasted coffee beans that are sourced directly from independent farmers and farm cooperatives. We’re proud to offer a variety of coffee beans grown with great care for the environment and local communities. Check our post or contact us directly for current availability. + - image: "/img/illustrations/coffee-gear.svg" + text: | + We offer a small, but carefully curated selection of brewing gear and tools for every taste and experience level. No matter if you roast your own beans or just bought your first french press, you’ll find a gadget to fall in love with in our shop. + - image: "/img/illustrations/tutorials.svg" + text: | + Love a great cup of coffee, but never knew how to make one? Bought a fancy new Chemex but have no clue how to use it? Don't worry, we’re here to help. You can schedule a custom 1-on-1 consultation with our baristas to learn anything you want to know about coffee roasting and brewing. Email us or call the store for details. + - image: "/img/illustrations/meeting-space.svg" + text: | + We believe that good coffee has the power to bring people together. That’s why we decided to turn a corner of our shop into a cozy meeting space where you can hang out with fellow coffee lovers and learn about coffee making techniques. All of the artwork on display there is for sale. The full price you pay goes to the artist. +main: + heading: Great coffee with no compromises + description: | + We hold our coffee to the highest standards from the shrub to the cup. That’s why we’re meticulous and transparent about each step of the coffee’s journey. We personally visit each farm to make sure the conditions are optimal for the plants, farmers and the local environment. + image1: + image: /img/products/products-grid3.jpg + alt: A close-up of a paper filter filled with ground coffee + image2: + image: /img/products/products-grid2.jpg + alt: A green cup of a coffee on a wooden table + image3: + image: /img/products/products-grid1.jpg + alt: Coffee beans +testimonials: + - quote: "The first time I tried Kaldi’s coffee, I couldn’t even believe that was the same thing I’ve been drinking every morning." + author: "Elisabeth Kaurismäki" + - quote: "Kaldi is the place to go if you want the best quality coffee. I love their stance on empowering farmers and transparency." + author: "Philipp Trommler" +full_image: /img/products/products-full-width.jpg +pricing: + heading: "Monthly subscriptions" + description: "We make it easy to make great coffee a part of your life. Choose one of our monthly subscription plans to receive great coffee at your doorstep each month. Contact us about more details and payment info." + plans: + - plan: "Small" + price: "50" + description: "Perfect for the drinker who likes to enjoy 1-2 cups per day." + items: ["3 lbs of coffee per month", Green or roasted beans", One or two varieties of beans"] + - plan: Big + price: "80" + description: Great for avid drinkers, java-nsoving couples and bigger crowds + items: ["6 lbs of coffee per month", "Green or roasted beans", "Up to 4 different varieties of beans"] + - plan: Custom + price: "?" + description: "Want a few tiny batches from different varieties? Try our custom plan" + items: ["Whatever you need", "Green or roasted beans", "Unlimited varieties"] +--- diff --git a/site/layouts/partials/4-up.html b/site/layouts/partials/4-up.html index dcfbbbf..d57d043 100644 --- a/site/layouts/partials/4-up.html +++ b/site/layouts/partials/4-up.html @@ -4,33 +4,12 @@

{{.description}}

- -
- -

{{.text1}}

-
- -
- -

{{.text2}}

-
- -
- -

{{.text3}}

-
- -
- -

{{.text4}}

-
- + {{ range .blurbs }} +
+ +

{{ .text }}

+
+ {{ end }}
- - {{ if .buttonText }} -
- {{.buttonText}} -
- {{ end }} diff --git a/site/layouts/partials/blockquote.html b/site/layouts/partials/blockquote.html index 85920f0..1c851e1 100644 --- a/site/layouts/partials/blockquote.html +++ b/site/layouts/partials/blockquote.html @@ -1,6 +1,6 @@
-

{{.quote}}

- {{.author}} +

“{{ .quote }}”

+ {{ .author }}
diff --git a/site/layouts/partials/head.html b/site/layouts/partials/head.html index bd2f1da..9c72ea1 100644 --- a/site/layouts/partials/head.html +++ b/site/layouts/partials/head.html @@ -3,7 +3,7 @@ - {{.Title}} | Kaldi + {{ .Title }} | Kaldi diff --git a/site/layouts/partials/image-grid.html b/site/layouts/partials/image-grid.html index 726be38..5ead5f1 100644 --- a/site/layouts/partials/image-grid.html +++ b/site/layouts/partials/image-grid.html @@ -2,15 +2,15 @@
- A close-up of a paper filter filled with ground coffee + {{ .image1.alt }}
- A green cup of a coffee on a wooden table + {{ .image2.alt }}
- Coffee beans + {{ .image3.alt }}
diff --git a/site/layouts/partials/table-column.html b/site/layouts/partials/table-column.html index 5713f65..7d2f49e 100644 --- a/site/layouts/partials/table-column.html +++ b/site/layouts/partials/table-column.html @@ -13,15 +13,12 @@ diff --git a/site/layouts/partials/table.html b/site/layouts/partials/table.html index 95f639b..2b521a9 100644 --- a/site/layouts/partials/table.html +++ b/site/layouts/partials/table.html @@ -3,21 +3,12 @@

{{.heading}}

-

{{.text}}

+

{{.description}}

- -
{{ partial "table-column" (dict "plan" "Small" "price" "50" "description" "Perfect for the drinker who likes to enjoy 1-2 cups per day." "item1" "3 lbs of coffee per month" "item2" "Green or roasted beans" "item3" "One or two varieties of beans") }} -
- -
- {{ partial "table-column" (dict "plan" "Big" "price" "80" "description" "Great for avid drinkers, java-nsoving couples and bigger crowds" "item1" "6 lbs of coffee per month" "item2" "Green or roasted beans" "item3" "Up to 4 different varieties of beans") }} -
- -
- {{ partial "table-column" (dict "plan" "Custom" "price" "?" "description" "Want a few tiny batches from different varieties? Try our custom plan" "item1" "Whatever you need" "item2" "Green or roasted beans" "item3" "Unlimited varieties") }} -
- + {{ range .plans }} +
{{ partial "table-column" . }}
+ {{ end }}
diff --git a/site/layouts/products/single.html b/site/layouts/products/single.html index 162c195..bf430ca 100644 --- a/site/layouts/products/single.html +++ b/site/layouts/products/single.html @@ -1,29 +1,32 @@ {{ partial "head" . }} {{ partial "nav" . }} -{{ partial "jumbotron" (dict "imageUrl" "/img/products/jumbotron.jpg" "title" "Products") }} +{{ partial "jumbotron" (dict "imageUrl" .Params.image "title" .Title) }} -{{ partial "4-up" (dict "heading" "What we offer" "description" "Kaldi is the ultimate spot for coffee lovers who want to learn about their java’s origin and support the farmers that grew it. We take coffee production, roasting and brewing seriously and we’re glad to pass that knowledge to anyone." "svg1" "/img/illustrations/coffee.svg" "text1" "We sell green and roasted coffee beans that are sourced directly from independent farmers and farm cooperatives. We’re proud to offer a variety of coffee beans grown with great care for the environment and local communities. Check our post or contact us directly for current availability." "svg2" "/img/illustrations/coffee-gear.svg" "text2" "We offer a small, but carefully curated selection of brewing gear and tools for every taste and experience level. No matter if you roast your own beans or just bought your first french press, you’ll find a gadget to fall in love with in our shop." "svg3" "/img/illustrations/tutorials.svg" "text3" "Love a great cup of coffee, but never knew how to make one? Bought a fancy new Chemex but have no clue how to use it? Don't worry, we’re here to help. You can schedule a custom 1-on-1 consultation with our baristas to learn anything you want to know about coffee roasting and brewing. Email us or call the store for details." "svg4" "/img/illustrations/meeting-space.svg" "text4" "We believe that good coffee has the power to bring people together. That’s why we decided to turn a corner of our shop into a cozy meeting space where you can hang out with fellow coffee lovers and learn about coffee making techniques. All of the artwork on display there is for sale. The full price you pay goes to the artist." ) }} +{{ partial "4-up" .Params.intro }} + +{{ with .Params.main }}
-

Great coffee with no compromises

-

We hold our coffee to the highest standards from the shrub to the cup. That’s why we’re meticulous and transparent about each step of the coffee’s journey. We personally visit each farm to make sure the conditions are optimal for the plants, farmers and the local environment.

+

{{ .heading }}

+

{{ .description }}

{{ partial "image-grid" . }} +{{ end }}
- {{ partial "blockquote" (dict "quote" "“The first time I tried Kaldi’s coffee, I couldn’t even believe that was the same thing I’ve been drinking every morning.”" "author" "Elisabeth Kaurismäki") }} - - {{ partial "blockquote" (dict "quote" "“Kaldi is the place to go if you want the best quality coffee. I love their stance on empowering farmers and transparency.”" "author" "Philipp Trommler") }} + {{ range .Params.testimonials }} + {{ partial "blockquote" . }} + {{ end }}
- + -{{ partial "table" (dict "heading" "Monthly subscriptions" "text" "We make it easy to make great coffee a part of your life. Choose one of our monthly subscription plans to receive great coffee at your doorstep each month. Contact us about more details and payment info.") }} +{{ partial "table" .Params.pricing }} {{ partial "footer" . }} diff --git a/site/static/admin/config.yml b/site/static/admin/config.yml index 4f6fe4a..374bf44 100644 --- a/site/static/admin/config.yml +++ b/site/static/admin/config.yml @@ -1,6 +1,6 @@ backend: name: github - repo: darindimitroff/netlify-cms-template # Path to your Github repository + repo: netlify-templates/kaldi-hugo-cms-template # Path to your Github repository branch: master # Branch to update (master by default) media_folder: "dist/img" # Folder where user uploaded files should go @@ -9,9 +9,26 @@ public_folder: "dist" # CMS now knows 'source' is the public folder and will str collections: # A list of collections the CMS should be able to edit - name: "post" # Used in routes, ie.: /admin/collections/:slug/edit label: "Post" # Used in the UI, ie.: "New Post" - folder: "/site/content/post" # The path to the folder where the documents are stored + folder: "site/content/post" # The path to the folder where the documents are stored create: true # Allow users to create new documents in this collection fields: # The fields each document in this collection have - {label: "Title", name: "title", widget: "string"} - {label: "Publish Date", name: "date", widget: "datetime"} - {label: "Body", name: "body", widget: "markdown"} + - name: "pages" + label: "Pages" + files: + file: "site/content/products.md" + fields: + - {label: Title, name: title, widget: string} + - {label: Type, name: type, widget: string} + - {label: Image, name: image, widget: image} + - {label: Page, name: page, widget: string} + - {label: Heading, name: heading, widget: string} + - {label: Description, name: description, widget: string} + - {label: Intro, name: intro, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: text}, {label: Blurbs, name: blurbs, widget: list, fields: [{label: Image, name: image, widget: image}, {label: Text, name: text, widget: text}]}]} + - {label: Main, name: main, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: text}, {label: Image1, name: image1, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}, {label: Image2, name: image2, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}, {label: Image3, name: image3, widget: object, fields: [{label: Image, name: image, widget: image}, {label: Alt, name: alt, widget: string}]}]} + - {label: Testimonials, name: testimonials, widget: list, fields: [{label: Quote, name: quote, widget: string}, {label: Author, name: author, widget: string}]} + - {label: Full_image, name: full_image, widget: image} + - {label: Pricing, name: pricing, widget: object, fields: [{label: Heading, name: heading, widget: string}, {label: Description, name: description, widget: string}, {label: Plans, name: plans, widget: list, fields: [{label: Plan, name: plan, widget: string}, {label: Price, name: price, widget: string}, {label: Description, name: description, widget: string}, {label: Items, name: items, widget: list}]}]} + - {label: Body, name: body, widget: markdown} -- cgit v1.3