'universal_meganav' is the name of my contentful space. My data folder looks like:
PCWLCTeTCKsaoGGSQOc6i.yaml is generated by the contenful_middleman build
command. It contains:
---
:id: PCWLCTeTCKsaoGGSQOc6i
:pageTitle: This is a test title
How do I access this :pageTitle:
in my views without relying on the generated file name?
<%= data.universal_meganav.homepage %>
returns
{"PCWLCTeTCKsaoGGSQOc6i"=>{"id"=>"PCWLCTeTCKsaoGGSQOc6i", "pageTitle"=>"This is a test title"}}
I was trying <%= data.universal_meganav.homepage[0] %>
but this isn't working. I've seen examples manipulating the data in config.rb in a loop but I get an error of "NoMethodError: undefined method 'universal_meganav' for nil:NilClass" if I try and access data.universal_meganav
in config.rb
You can access the content as a list: