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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -