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

Automate matching between posts slugs and base images folders #60

Closed
wants to merge 6 commits into from
Closed

Conversation

nhoizey
Copy link

@nhoizey nhoizey commented Apr 20, 2015

This helps avoiding a mess in the base images folder

nhoizey added a commit to nhoizey/nicolas-hoizey.com that referenced this pull request Apr 22, 2015
@btobolaski
Copy link
Contributor

I'm not sure that I quite understand what this is intended to do. From what I gather, this is designed to allow your image paths to contain portions of your post's slug, correct me if I'm wrong. While I prefer to just dump all of my images into a single folder, I do see how this could be useful.

I currently see two issues with this as it currently stands.

  1. It doesn't account for images contained within no post pages.

When I tried this on my site, I simply got a Liquid Exception: undefined method[]' for nil:NilClass in .md`. Most of that is attributable to the lack of error handling for nonexistent files but, this wouldn't point someone towards why they weren't able to use this on a picture tag on a page. Perhaps one way to handle this would be to check whether we are currently processing a page before applying the slug path.

  1. I would prefer this to be a preset level configuration rather than a global configuration.

It makes sense, to me, that different preset could be configured for different slugs. This would allow someone to define one preset that works with posts and contains part of the post's slug and one preset that works for any page.

Thanks for taking the time to send me a pull request, I really appreciate it. If you'd like to put in some more work to get this merged in, I'd be happy to work with you.

@nhoizey
Copy link
Author

nhoizey commented Apr 23, 2015

I'm not sure that I quite understand what this is intended to do. From what I gather, this is designed to allow your image paths to contain portions of your post's slug, correct me if I'm wrong. While I prefer to just dump all of my images into a single folder, I do see how this could be useful.

That's right. My aim is to ease content management. I really would like to put each markdown file in a folder with it's specific assets. I have hundreds of blog posts written since 2001, and as many images that illustrate them. Having everything in one single assets folder is not a realistic option.

See this tweet.

I want to be able to move a post easily, from drafts to posts for example, or even from one blog to another — yes, I have several… ;-) — so it would be really easier with one single folder.

I currently see two issues with this as it currently stands.

  1. It doesn't account for images contained within no post pages.

True, I have to add this!

When I tried this on my site, I simply got a Liquid Exception: undefined method[]' for nil:NilClass in .md`. Most of that is attributable to the lack of error handling for nonexistent files

I also have to handle nonexistent files, you're right.

but, this wouldn't point someone towards why they weren't able to use this on a picture tag on a page. Perhaps one way to handle this would be to check whether we are currently processing a page before applying the slug path.

Or maybe just add a specific option in the settings, with a different path that wouldn't contain any date.

  1. I would prefer this to be a preset level configuration rather than a global configuration.
    It makes sense, to me, that different preset could be configured for different slugs. This would allow someone to define one preset that works with posts and contains part of the post's slug and one preset that works for any page.

You're right, I'll do this.

Thanks for taking the time to send me a pull request, I really appreciate it. If you'd like to put in some more work to get this merged in, I'd be happy to work with you.

Thanks a lot for your valuable feedback, I'll try to push an update to this PR asap!

@btobolaski
Copy link
Contributor

Thats great to hear. The point that I was making about nonexistent files is that the plugin currently doesn't handle that at all. If you want to also handle that, thats great but it shouldn't be considered a blocker for getting this change in.

@nhoizey
Copy link
Author

nhoizey commented Apr 23, 2015

Ok, I didn't understand that, great! ;-)

@nhoizey
Copy link
Author

nhoizey commented Apr 24, 2015

If folders hierarchy is in the preset, don't you think source, output and even markup could be to?

@btobolaski
Copy link
Contributor

I don't see much of a need for markup. I think its unlikely that we'll ever support anything else. As for source and output, I think that they could be on the presets but I'd like them to default to the globally defined options.

@nhoizey
Copy link
Author

nhoizey commented Aug 2, 2016

There is no need for this here anymore, there's now the Jekyll Post Files plugin.

@nhoizey nhoizey closed this Aug 2, 2016
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.

2 participants