I'm building a web page using Poole/Lanyon. A file uses a multi-level or nested site variable like {{ site.github.repo }}
.
As a novice in Ruby and YAML, I'm not sure how I should declare this value in _config.yml
. I tried like this in _config.yml
:
github:
- repo: 'https://github.com/foo/bar.github.io'
It was not working: an empty string is returned when I use {{ site.github.repo }}
. I'm however able to get {{ site.github }}
like this:
{"repo"=>"https://github.com/foo/bar.github.io"}
In order to use site.github.repo
, how should I define this variable in the configuration file?
In your _config.yml
, you've defined site.github
as a list, and you're trying to access it as an associative array, hence the problem.
If you want to access it as an associative array, you'll need to redefine your variable as such:
github:
repo: 'https://github.com/foo/bar.github.io'
As of writing this, I don't think that the Wikipedia sections I have linked to are super clear, but you can refer to their sample document, which I think showcases YAML's possibilities pretty well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With