Fix image paths
This commit is contained in:
parent
2c2b0bd0b6
commit
096e506c1f
|
|
@ -69,7 +69,7 @@ module.exports = config => {
|
|||
|
||||
/* Shortcodes */
|
||||
const imageShortcode = async (src, className, alt, sizes) => {
|
||||
let metadata = await Image(`./src/recipe-images/${src}.jpg`, {
|
||||
let metadata = await Image(`./src/${src}`, {
|
||||
widths: [600, 1500, 3000],
|
||||
formats: ['webp', 'jpeg'],
|
||||
outputDir: './dist/recipe-images',
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ bodyClass: c-home
|
|||
{% set favouriteRecipes = collections["Favourite ⭐"] | limit(4) %}
|
||||
{% for recipe in favouriteRecipes %}
|
||||
<a class="c-card" href="{{ recipe.url }}">
|
||||
{% recipeimage recipe.fileSlug, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %}
|
||||
{% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %}
|
||||
<div class="c-card__info">
|
||||
<div>
|
||||
{% for tag in recipe.data.tags %}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'layouts/base.njk' %}
|
||||
|
||||
{% block content %}
|
||||
{% recipeimage page.fileSlug, "c-recipe__header-image", title, "100vw" %}
|
||||
{% recipeimage image, "c-recipe__header-image", title, "100vw" %}
|
||||
<h1 class="c-recipe__title">{{ title }}</h1>
|
||||
<section>
|
||||
<div class="l-container">
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
{% for recipe in collections.recipes %}
|
||||
{% if not selectedTag or selectedTag in recipe.data.tags %} {# If we don't have a selectedTag, we are on the all recipes page #}
|
||||
<a class="c-card" href="{{ recipe.url }}">
|
||||
{% recipeimage recipe.fileSlug, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %}
|
||||
{% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %}
|
||||
<div class="c-card__info">
|
||||
<div>
|
||||
{% for tag in recipe.data.tags %}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,12 @@ collections:
|
|||
create: true
|
||||
fields:
|
||||
- {label: "Title", name: "title", widget: "string"}
|
||||
- {label: "Tags", name: "tags", widget: "list"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- label: "Tags"
|
||||
name: "tags"
|
||||
widget: "list"
|
||||
summary: "{{fields.tag}}"
|
||||
field: {label: "Tag", name: "tag", widget: string}
|
||||
- {label: "Preparation time", name: "time", widget: "string"}
|
||||
- {label: "Number of servings", name: "servings", widget: "number"}
|
||||
- {label: "Source of the recipe", name: "sourceLabel", widget: "string"}
|
||||
|
|
@ -19,4 +24,5 @@ collections:
|
|||
- label: "Ingredients"
|
||||
name: "ingredients"
|
||||
widget: "list"
|
||||
field: {label: Ingredient, name: ingredient, widget: string}
|
||||
summary: "{{fields.ingredient}}"
|
||||
field: {label: "Ingredient", name: "ingredient", widget: string}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: Coconut lentil soup
|
||||
image: /recipe-images/coconut-lentil-soup.jpg
|
||||
tags:
|
||||
- Soup 🥣
|
||||
- Vegan 🌱
|
||||
|
|
|
|||
30
src/recipes/simple-brownies.md
Normal file
30
src/recipes/simple-brownies.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: Simple brownies
|
||||
image: /recipe-images/brownies.jpg
|
||||
tags:
|
||||
- Sweet 🍬
|
||||
- Cake 🍰
|
||||
- Sharable
|
||||
- Favourite ⭐
|
||||
time: 45 min
|
||||
sourceLabel: BBC good food
|
||||
sourceURL: https://www.bbc.co.uk/food/recipes/richchocolatebrownie_1933/
|
||||
servings: 4
|
||||
ingredients:
|
||||
- 225g butter (preferably unsalted)
|
||||
- 450g caster sugar
|
||||
- 140g dark chocolate broken into pieces
|
||||
- 5 free-range medium eggs
|
||||
- 110g plain flour
|
||||
- 55g cocoa powder
|
||||
---
|
||||
|
||||
Heat the oven to 190C/170C Fan/Gas 5. Line a 20x30cm baking tin with baking paper.
|
||||
|
||||
Gently melt the butter and the sugar together in a large pan. Once melted, take off the heat and add the chocolate. Stir until melted.
|
||||
|
||||
Beat in the eggs, then stir in the flour and the cocoa powder.
|
||||
|
||||
Pour the brownie batter into the prepared tin and bake for 30–35 minutes, or until the top of the brownie is just firm but there is still a gentle wobble in the middle.
|
||||
|
||||
Take out of the oven and leave to cool in the tin. Cut the brownies into 5cm squares when only just warm, or completely cool.
|
||||
Loading…
Reference in a new issue