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
I would expect that I could then access both data sources via site.data.samename.csv and site.data.samename.json (or some equivalent hash lookup similar to site.data['samename.json']).
Current Behavior
site.data.samename (or variants) only returns the contents of the .csv file. The .json file is not accessible at all.
Code Sample
The behavior is presumably because while data_reader.rb reads all data files, it indexes them by File.basename, meaning that any same-basenamed files will always only show data from the file with (presumably) the extension that happens to be last in the Dir glob here:
Question: Is this an intended feature, or merely something no-one has considered as a use case yet? My use case is an open data portal, where we host various .csv files (of government budgets, etc.), with a corresponding .json file that is the dcat:Dataset for the .csv file. There are valid reasons to have similarly named files in varying formats, so this seems like it would be useful (although I suppose fixing this would mean some data reading behaves subtly differently).
Thanks, Jekyll peeps!
The text was updated successfully, but these errors were encountered:
Is this an intended feature, or merely something no-one has considered as a use case yet?
Irrespective of the intention / design, this issue cannot be addressed without breaking existing workflows especially since the current behavior has remained the same from the time the feature was introduced.
Perhaps this may get considered for a v5.0.0 (which won't be happening in the near future).
Understood (and expected), I'll workaround; but please do consider this a plea for updating the docs to make it clear what order the files will be read in so others aren't surprised.
My Environment
jekyll
github-pages
Expected Behaviour
Given:
_data/samename.csv
_data/samename.json
I would expect that I could then access both data sources via site.data.samename.csv and site.data.samename.json (or some equivalent hash lookup similar to site.data['samename.json']).
Current Behavior
site.data.samename (or variants) only returns the contents of the .csv file. The .json file is not accessible at all.
Code Sample
The behavior is presumably because while data_reader.rb reads all data files, it indexes them by
File.basename
, meaning that any same-basenamed files will always only show data from the file with (presumably) the extension that happens to be last in the Dir glob here:https://github.com/jekyll/jekyll/blob/master/lib/jekyll/readers/data_reader.rb#L36
Question: Is this an intended feature, or merely something no-one has considered as a use case yet? My use case is an open data portal, where we host various .csv files (of government budgets, etc.), with a corresponding .json file that is the dcat:Dataset for the .csv file. There are valid reasons to have similarly named files in varying formats, so this seems like it would be useful (although I suppose fixing this would mean some data reading behaves subtly differently).
Thanks, Jekyll peeps!
The text was updated successfully, but these errors were encountered: