I have a Jekyll site with articles about products. At the top of each post.md
I include a file with {%- include vars -%}
. vars
is an include file that contains {%- include varfiles/product.html id=page.product -%}
. It automatically grabs the product number into the page, and then passes it to product.html
in the varfiles
folder. The following is product.html
{%- assign product = site.data.products | where:"id",include.id | first -%}
<!-- product name -->
{%- if product.name -%}
{%- capture product-name -%}
{{ product.name }}
{%- endcapture -%}
{%- endif -%}
plus a lot more similar to the code above
The file is essentially many types of variable name creators based on the product properties pulled from the products data file, which is a list of products. The result is when I add the {%- include vars -%}
at the top of any post.md
it will automatically generate easier to remember/use variables names based on the product id number in the frontmatter. Then I can include the variable names throughout the article like {{ product-name }}
and it automatically resolves from the variables that were created from the vars
include.
THE PROBLEM: Whne I upgrade jekyll to use 4.0 all of the variables are empty. When putting {{ product-name }}
somewhere in post.md
under the vars
include it would automatically convert it to the products name. On 4.0 it becomes empty. The only change I'm making is updating to Jekyll 4.0. If I downgrade all the variables work fine.