Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load data from data directory #523

Closed
wants to merge 1 commit into from
Closed

Load data from data directory #523

wants to merge 1 commit into from

Conversation

RealOrangeOne
Copy link
Contributor

Load data from a data directory rather than content/. This means the content directory is actually only used for content.

It's still possible to load data from the content directory, by prefixing the path argument with ../content/.

@Keats
Copy link
Collaborator

Keats commented Nov 16, 2018

cc @kellpossible

We did talk about where to put files in #379 (comment)

I want to release 0.5 tomorrow or sunday so there isn't much time to decide :)

@RealOrangeOne
Copy link
Contributor Author

Having data files related to content is a usage i'd not considered, but would actually be incredibly useful. I'm not sure of the right implementation for it though. Searching relative to multiple locations isn't very explicit, which I don't like.

oooh, here's a thought. What if we allow load_data to be given a page argument, which switches the load location from relative to the data directory, to searching the page assets only? (Obviously this would be ignored given a url argument?

Thoughts?

@Keats
Copy link
Collaborator

Keats commented Nov 16, 2018

What about doing the same approach as Hugo?
Any file in a data directory is automatically loaded so you only need to call load_data if you want to load a file outside of it or a URL.

@RealOrangeOne
Copy link
Contributor Author

That could work, although would be a much larger change than this, as it'd require a whole new global variable added to scope.

Making the data path configurable could be another way to do it?

@Keats
Copy link
Collaborator

Keats commented Nov 16, 2018 via email

@RealOrangeOne
Copy link
Contributor Author

It doesnt really work on config, as it's not really to do with config. Theoretically once we have auto-loading setup, we can attach data relative to pages direct to the page itself!

I'll close this, and consider an alternative implementation.

@RealOrangeOne RealOrangeOne deleted the data-dir branch November 16, 2018 18:46
@Keats
Copy link
Collaborator

Keats commented Nov 16, 2018 via email

@kellpossible
Copy link
Contributor

So what ended up happening @Keats @RealOrangeOne ?

@Keats
Copy link
Collaborator

Keats commented Nov 17, 2018

I'll just mark that data is reserved in the breaking changes and we can see later!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants