Check out the new Ingredients Taxonomy pages
Using Taxonomy effectively
As part of the recipe template configuration being developed for The Ryder Theme for Hugo websites, a new taxonomy is created for ingredients. Ingredients are not the same as recipeIngredients; they are defined as an array in the front matter. I didn’t want a taxonomy page generated for every single recipe ingredient, so I created a separate variable. The recipeIngredients are used to display the ingredients on the page and for the recipe schema, ensuring the pages are properly displayed as recipe rich results in Google and other search engines.
From my regular sample data recipe of Tarragon Beets Salad, you can see how they are different. One is for general items, and the other specifies the exact amount and details. It is a duplication of data, but it allows the many features of Hugo taxonomies to be fully utilized.
ingredients = [
"beets",
"celery",
...
]
recipeIngredients = [
"**FOR SALAD",
"5 Beets",
"½ heart of celery",
...
]
You add ingredients to the taxonomy by including them in the front matter of your pages. Alternatively, you can create pages in the directory path where they land to add intro text, images, or additional parameters in the front matter. For instance, the page about mushrooms is created automatically without anything added to your content directory. However, if you wish to add to it, simply create a list page in the correct location. In this instance, the following page is in the content directory: ./content/ingredients/mushrooms/_index.md.
The documentation does cover this at the tail end of the taxonomy section.
+++
title = 'Mushrooms'
date = 2024-05-29T23:24:31-07:00
# draft = true
# summary = ""
# categories = [""]
tags = [
"Photography",
"ingredients"
]
featured_image = "oyster_feature.jpg"
homeFeatureIcon = "fa-solid fa-dragon"
# showTOC = true
+++
{{< picture
alt="Beautiful Oyster Mushrooms"
overlay="images/bs_full_wordmark.png"
src="oyster_feature.jpg"
title="Beautiful Oyster Mushrooms"
>}}
<!--more-->
These taxonomy pages will ultimately lead to being able to create related content features and pull in lists of content or products with similar taxonomic themes.