jekyll - How to use a variable included in a layout in posts using that layout? -
consider following 3 snippets specified files:
<!-- _includes/my_var.html --> {% assign my_var = 'foo' %}
and
<!-- _layouts/default.html --> {% include my_var.html %} ...
and post:
--- layout: default --- i'd reference {{my_var}}
the last 1 doesn't appear see variable defined in includes file. nil
value of my_var
. wrong expect should in scope? if so, what's alternative approach?
you cannot layout variables page or post.
but, looks configuration variable, can set in _config.yml , access anywhere site.my_var
.
Comments
Post a Comment