Recipes: move to tandoor, provide public share links
ci/woodpecker/push/woodpecker Pipeline was successful Details

Have a nice table that can be sorted, as well as yaml output

Closes: #13
pull/14/head
earnest ma 2 years ago
parent 32bfe7f4a3
commit 6660d0bd3d
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A

4
.gitignore vendored

@ -1,6 +1,6 @@
node_modules/
data/bookwyrm.json
public/
resources
static/recipes.yaml

@ -10,11 +10,13 @@ OUTPUT_DIR = public
.PHONY: hugo
hugo: clean
cp data/recipes.yaml static/recipes.yaml
hugo -b $(HUGO_BASEURL) $(HUGO_FLAGS)
.PHONY: clean
clean:
rm -rf $(OUTPUT_DIR)
rm -rf static/recipes.yaml
.PHONY: serve
serve:

@ -0,0 +1,13 @@
+++
title = "Recipes"
aliases = [
"/recipes/vanilla-coconut-matcha-latte" # redirect one previous entry, just in case
]
type = "recipes" # type
+++
Here are some recipes I've <abbr title="click the link for attribution">obtained</abbr> or made myself.
Most links are go to my *[Tandoor](https://recipes.earne.link)* instance. It does not have a public view, so I am manually providing the share links here.
*Tip*: you can also grab a [commented YAML file](/recipes.yaml).

@ -1,5 +0,0 @@
+++
title = "Recipes"
+++
Here are some recipes I've obtained from various sources/made myself. If applicable, the creators have been linked -- just saving them in one place for sharing and organization purposes!

@ -1,36 +0,0 @@
+++
title = "Vanilla Coconut Matcha Latte"
date = '2021-12-10 10:14:50 -0500'
tags = ["Drinks"]
source = "https://www.pickuplimes.com/recipe/vanilla-coconut-matcha-latte-740"
sourceAuthor = "Pick Up Limes"
complexity = ["Easy"]
+++
- 2 servings
- Total 5 min (Prep 5 min)
### Ingredients
- 4 tsp (25g) vanilla sugar
- Can swap for regular granulated sugar with a drop of vanilla extract
- 2 tsp (4g) matcha powder
- 1 tsp (4g) coconut sugar
### Directions
- 0.75 cups (180 mL) // 1.5 cups (360 mL) barista oat milk
- Or gluten-free oat milk/ unsweetened soy milk
- 0.5 cup (120 mL) // 1 cup (240 mL) canned light coconut milk
- 2 Tbsp (30 mL) // 4 Tbsp (60 mL) hot water at around 80C/ 175F
1. Mix and combine the matcha powder and sugars.
2. To a saucepan, add the oat milk and coconut milk. Whisk throught, and remove from the heat when hot but not yet boiling.
3. To make one latte, add 1 Tbsp of the powdered mix and 2 Tbsp (30 mL) of hot water to a cup (avoid boiling water). Whisk until there are no more lumps.
### Notes
Optional toppings:
- Foamed milk
- Matcha powder

@ -0,0 +1,8 @@
---
favourites: # name, link, desc
all: # name, link, date, category
- name: Vanilla Coconut Matcha Latte
link: https://recipes.earne.link/view/recipe/1/4efc68a0-a70f-4c60-8186-1d70a0b1c772
date: "2022-02-21"
category: Drink

@ -27,17 +27,5 @@
</div>
</small>
{{ end -}}
{{- if eq .RelPermalink "/recipes/" -}}
Tags:
{{ range .Site.Taxonomies.tags }}
<a href="{{ .Page.Permalink }}">#{{ .Page.Title }}</a>&nbsp;
{{ end }}<br>
Complexity:
{{ range .Site.Taxonomies.complexity }}
<a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a>&nbsp;
{{ end }}
{{ end -}}
{{ end }}
{{ end }}

@ -1,34 +1,71 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
<ul>
<li>Published on {{ .Date.Format "Jan 02, 2006" }}
{{ if .Lastmod }}{{ if not (eq .Lastmod .Date )}}
<i>(<b>updated</b> {{ dateFormat "2006-01-02" .Lastmod.Local }})</i>
{{ end }}{{ end }}</li>
<li>Tags: {{ range (.GetTerms "tags") }}<a href="{{ .Permalink }}">#{{ .LinkTitle }}</a> {{ end }}</li>
<li>Complexity: {{ range (.GetTerms "complexity") }}<a href="{{ .Permalink }}">{{ .LinkTitle }}</a> {{ end }}</li>
{{ if .Params.source }}<li><a href="{{ .Params.source }}">🔗Source link</a>{{ if .Params.sourceAuthor }}: {{ .Params.sourceAuthor }}{{ end }}</li>{{ end }}
</ul>
<h1>Recipes</h1>
<content>
{{ .Content }}
{{ .Content }}
<h2>Favorites</h2>
<ul>{{ range .Site.Data.recipes.favourites }}
<li><a href="{{ .link | safeURL }}">{{ .name }}</a>{{ if .desc }}: {{ .desc }}{{ end }}</li>
{{ end }}
</ul>
<h2>All</h2>
<p><i>Columns can be clicked to sort!</i></p>
<table id="recipesAll">
<tr>
<th onclick="sortTable(0)">Name</th>
<th onclick="sortTable(1)">Category</th>
<th onclick="sortTable(2)">Date</th>
</tr>
{{ range .Site.Data.recipes.all }}
<tr>
<td><a href="{{ .link | safeURL }}">{{ .name }}</a></td>
<td>{{ .category }}</td>
<td>{{ .date }}</td>
</tr>
{{ end }}
</table>
</content>
<br><hr>
{{ if not (in (.Site.BaseURL | string) "localhost") }}
{{ if not .Params.disableComments }}
{{ partial "comments.html" . }}
{{ else }}
Comments are off for this post.
{{ end }}
{{ else }}
Comments will not be loaded: at <code>localhost</code>.
{{ end }}
<script>
function sortTable(n) {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("recipesAll");
switching = true;
dir = "asc";
while (switching) {
switching = false;
rows = table.rows;
for (i = 1; i < (rows.length - 1); i++) {
shouldSwitch = false;
x = rows[i].getElementsByTagName("TD")[n];
y = rows[i + 1].getElementsByTagName("TD")[n];
if (dir == "asc") {
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
} else if (dir == "desc") {
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
shouldSwitch = true;
break;
}
}
}
if (shouldSwitch) {
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
<div align="center">
{{ with .PrevInSection }}<a href="{{ .Permalink }}"><button>Previous post</button></a>{{ end }}
<a href="/recipes"><button>Back to list</button></a>
{{ with .NextInSection }}<a href="{{ .Permalink }}"><button>Next post</button></a>{{ end }}
</div>
switchcount ++;
} else {
if (switchcount == 0 && dir == "asc") {
dir = "desc";
switching = true;
}
}
}
}
</script>
{{ end }}

Loading…
Cancel
Save