Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll accessing page variables from CSS

I'm trying to set a background-img in my css.liquid file, and I need to get YAML variables in the page. How can I do that? This is what I have so far:

background-image: url({{ page.locales[page.default_locale][page.first_name] }});

I also had this:

background-image: url('{{ page.first_name }}{{ page.last_name }}.jpg');
like image 272
irosenb Avatar asked Oct 21 '22 03:10

irosenb


1 Answers

Just use these styles 'inline' and not in your css.liquid file. That is by far the easiest (and least ugly) solution.

like image 150
JoostS Avatar answered Oct 27 '22 17:10

JoostS