Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/seanlane/gochowdown.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Lane <git@sean.lane.sh>2020-11-27 07:18:19 +0300
committerSean Lane <git@sean.lane.sh>2020-11-27 07:18:28 +0300
commit54b825ad0fd57160ac62fb70b77cb6e8959ebcca (patch)
treec5f8c414b751019f90b06adcb48f62c323a6d88f
parentb5dfc905e8b4302ba5226622807c80df2f25de0c (diff)
Add view for components, per @RMHogervorst
https://github.com/seanlane/gochowdown/issues/6#issuecomment-681973850
-rw-r--r--layouts/components/single.html148
1 files changed, 148 insertions, 0 deletions
diff --git a/layouts/components/single.html b/layouts/components/single.html
new file mode 100644
index 0000000..5b0778f
--- /dev/null
+++ b/layouts/components/single.html
@@ -0,0 +1,148 @@
+{{ define "title" }}
+ {{ .Title }} ยท {{ .Site.Title }}
+{{ end }}
+{{ define "content" }}
+
+<div class="container" itemscope itemtype="http://schema.org/Recipe">
+<!-- call up the image and image credit link -->
+ {{ with .Params.Image }}
+ <div class="xs-p2">
+ <img itemprop="image" src="{{ . }}" />
+ </div>
+ {{ else }}
+ {{ range first 1 (.Resources.ByType "image") }}
+ <div class="xs-p2">
+ <img itemprop="image" src="{{$.Site.BaseURL}}{{ .RelPermalink }}" />
+ </div>
+ {{ end }}
+ {{ end }}
+
+ <article class="post-content px2">
+ <!-- call up the main recipe title and content -->
+ <header class="post-header">
+ <h1 class="post-title center m1 sm-mt3" itemprop="name">{{ .Title }}</h1>
+ </header>
+
+ <div class="px2 mt3 clearfix">
+ <div class="sm-col-8 mx-auto" itemprop="description">{{.Content}}</div>
+ </div>
+
+ <div class="clearfix mt3">
+ {{ with .Params.yield }}
+ <div class="sm-col sm-col-2">
+ <h4 class="blue mt0 mb2 xs-center">Yields: {{ . }}</h4>
+ </div>
+ {{ end }}
+ {{ with .Params.prepTime }}
+ <div class="sm-col sm-col-2">
+ <h4 class="blue mt0 mb2 xs-center">Preparation time: {{ . }}</h4>
+ </div>
+ {{ end }}
+ {{ with .Params.cookTime }}
+ <div class="sm-col sm-col-2">
+ <h4 class="blue mt0 mb2 xs-center">Cooking time: {{ . }}</h4>
+ </div>
+ {{ end }}
+ </div>
+
+ <!-- call up recipe and directions -->
+ <div class="clearfix mt3">
+ <div class="sm-col sm-col-6 lg-col-6 recipeItems">
+ <!-- check if it's a component-based recipe -->
+ {{ with .Params.Components}}
+ <h4 class="blue mt0 mb2 xs-center">Components</h4>
+ <ul>
+ <!-- list components that make up recipe -->
+ {{ range . }}
+ <li>
+ {{ with ( . | markdownify) }}{{ partial "recipe_item.html" . }}{{ end }}
+ </li>
+ {{ end }}
+ </ul>
+ {{ end }}
+
+ {{ with .Params.Ingredients }}
+ <h4 class="blue mt0 mb2 xs-center">Ingredients</h4>
+ <ul itemprop="ingredients">
+ <!-- list ingredients that make up recipe -->
+ {{ range . }}
+ <li itemprop="recipeIngredient">
+ {{ with ( . | markdownify) }}{{ partial "recipe_item.html" . }}{{ end }}
+ </li>
+ {{ end }}
+ </ul>
+ {{ end }}
+ </div>
+
+ <div class="sm-col sm-col-6 lg-col-6 recipeItems">
+ <h4 class="blue mt0 mb2 xs-center">Directions</h4>
+ <ul itemprop="recipeInstructions">
+ {{ range .Params.Directions }}
+ <li>
+ {{ with ( . | markdownify) }}{{ partial "recipe_item.html" . }}{{ end }}</li>
+ {{ end }}
+ </ul>
+ </div>
+ </div>
+ <!-- end recipe and directions -->
+
+ <!-- check if it's a component-based recipe, render it -->
+ {{ with .Params.Components }}
+ <div class="components bg-darken-2 p2 mt3 mb3 center">
+ &darr; This is a <strong class="blue">component-based recipe</strong> (fancy talk for making the dish in pieces, then assembling). &darr;
+ </div>
+
+ <div class="clearfix mxn2">
+ {{ range . }}
+ {{ $compTitle := . }}
+ <div class="sm-col sm-col-4 px2 recipeItems">
+ {{ range where $.Site.Pages "Title" $compTitle }}
+ <h4 class="blue center">{{ .Title }}</h4>
+ {{ range (.Resources.ByType "image") }}
+ <div class="image ratio bg-cover" style="background-image:url({{$.Site.BaseURL}}{{ .RelPermalink }});">
+ <img class="hide" itemprop="photo" src="{{$.Site.BaseURL}}{{ .RelPermalink }}" />
+ </div>
+ {{ end }}
+ {{ if .Params.Imagecredit }}
+ <a href="{{ .Params.Imagecredit }}" class="right">
+ <svg class="js-geomicon geomicon" width="14" height="14" data-icon="camera" viewBox="0 0 32 32" style="fill:currentcolor">
+ <title>camera icon</title>
+ <path d="M0 6 L8 6 L10 2 L22 2 L24 6 L32 6 L32 28 L0 28 z M9 17 A7 7 0 0 0 23 17 A7 7 0 0 0 9 17"></path>
+ </svg>
+ </a>
+ {{ end }}
+
+ <h4 class="blue regular xs-center">Ingredients</h4>
+ <ul class="ingredients" itemprop="ingredients">
+ {{ range .Params.Ingredients }}
+ <li itemprop="ingredient">
+ {{ with ( . | markdownify) }}{{ partial "recipe_item.html" . }}{{ end }}
+ </li>
+ {{ end }}
+ </ul>
+
+ <h4 class="blue regular xs-center">Steps</h4>
+ <ul itemprop="instructions">
+ {{ range .Params.Directions }}
+ <li>
+ {{ with ( . | markdownify) }}{{ partial "recipe_item.html" . }}{{ end }}
+ </li>
+ {{ end }}
+ </ul>
+
+ {{ end }}
+ </div>
+ {{ end }}
+ </div>
+
+ {{ end }}
+ <!-- end components -->
+ <br />
+
+ {{ with .Params.Category }}{{ partial "taxonomy/category" . }}{{ end }}
+ {{ with .Params.Cuisine }}{{ partial "taxonomy/cuisine" . }}{{ end }}
+ {{ with .Params.Tags }}{{ partial "taxonomy/tags" . }}{{ end }}
+
+ </article>
+</div>
+{{ end }}