I'm trying to pass one site collection to my page's layout, in order to be able to make my nav menu according to the sections I pass.
In my _config.yml
collections:
tt:
output: true
In my index.md page:
---
layout: mylayout
title: My Great Homepage
icon: fa-home
order: 1
sec: "{{site.tt}}"
---
In my layout:
---
layout: mylayout
---
{%- assign _sections = page.sec | flatify -%}
{%- include header.html scrolly_nav=_sections -%}
<!-- Main -->
<div id="main">
{{page.sec | flatify}} <!-- just to debug -->
</div>
Flatify is under _plugins/flatify.rb:
module Jekyll
module ExpandNestedVariableFilter
def flatify(input)
Liquid::Template.parse(input).render(@context)
end
end
end
Liquid::Template.register_filter(Jekyll::ExpandNestedVariableFilter)
In my layout, using {%- assign _sections = site.sec | flatify -%}
works perfectly, but when I pass the collection from the page to the layout, it's not working.
If I do the exact same thing passing site.title
instead of site.tt
from the page to the layout, everything works just fine. But when I try to pass a collection, it's not working.
Thanks for your help.