You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
I guess I expected all of the the navbar dataset and the site metadata to be available under the same accessors. My first attempt to fix this was to copy to the _data folder to my_collections, because that's what the docs say to do with the _posts folder, but unfortunately that gave me more unexpected behaviour
irb(main):001:0> site.data.navbar
nil
irb(main):002:0> site.data
{
"_data" => {
"navbar" => {
"title" => "Brand Title",
"icon" => "fa-rocket"
},
"site_metadata" => {
"title" => "Your awesome title",
"tagline" => "This site is totally awesome",
"email" => "your-email@example.com",
"description" => "Write an awesome description for your new site here. It will appear in your document head meta (for Google search results) and in your feed.xml site description."
}
}
}
irb(main):003:0> site.data._data.navbar
{
"title" => "Brand Title",
"icon" => "fa-rocket"
}
Additional context
I have made a few assumptions about how this should work and I'd be happy for someone to point me in the right direction or detail my errors. But I think the docs are a bit ambiguous in this regards too.
Anyway, If this is a bug or just something that needs tidying up, I'd be really happy to contribute a PR to make this more seamless and intuitive. I'll need some guidance on the best implementation and where best place to start.
The text was updated successfully, but these errors were encountered:
@robcarruthers Thanks Rob. Data is a special collection that I would expect would need to be relocated to the custom folder (aka my_collections/_data) along with the other collections. That it then adds in an extra _data key is unexpected, aka a bug. I'd love a PR and am happy to assist.
I don't really know where to start looking. I don't expect its something you keep front of mind either, but a high level view of how the site object is created initially and made available to the views would be a good place to start.
Testing/Dev Environment:
Test repo:
To Reproduce
Testing with a new site:
Add the following site data
Then in the console:
Add a collections directory as per the docs
then in the console:
Expected behavior
I guess I expected all of the the navbar dataset and the site metadata to be available under the same accessors. My first attempt to fix this was to copy to the _data folder to my_collections, because that's what the docs say to do with the _posts folder, but unfortunately that gave me more unexpected behaviour
Additional context
I have made a few assumptions about how this should work and I'd be happy for someone to point me in the right direction or detail my errors. But I think the docs are a bit ambiguous in this regards too.
Anyway, If this is a bug or just something that needs tidying up, I'd be really happy to contribute a PR to make this more seamless and intuitive. I'll need some guidance on the best implementation and where best place to start.
The text was updated successfully, but these errors were encountered: