Closed nhoizey closed 8 years ago
If I'm understanding your requirements correctly, this would be possible by allowing certain values like the post directory to be interpolated into base_path
.
Feel free to experiment and submit a PR. Otherwise I can look into it when I get some free time over the next couple of weeks.
I think that @nhoizey it trying to include images that are inside the _posts folder :
| - _posts
| - a_post_folder
| - img
| - 1.jpg
| - a_post.md
| - another_post_folder
| - img
| - 1.jpg
| - another_post.md
So yes, you would need to dynamically detect the base_path
and it would be different for every post's images.
@nhoizey : how do you imagine the images to be stored into _site
?
Here is an example of my current way to store post images: https://github.com/nhoizey/nicolas-hoizey.com/tree/master/_posts/2016/02/19-un-exemple-d-impact-des-raccourcisseurs-d-url
@wildlyinaccurate base_path
containing the post directory would be perfect.
@borisschapira as you can see with this one, I currently have generated images also in the post folder, but I don't have any issue with generated images being in the same assets/
subfolder if it's easier, I only need to put source images alongside their relative posts Markdown files.
I wonder if it would be possible to build another independant plugin that would solely allow us to set images_source
and images_destination
paths in _config.yml
, with:
false
which would let current behavior untouchedMy current fork of the picture plugin let me set this:
picture:
source: "_posts"
posts_folders: ":year/:month/:day-:slug/"
In fact, a MVP approach for this plugin would be to use the post's path as the source folder, and any arbitrary folder as the destination.
As I wrote in this comment on StackOverflow, most of —if not all— my images are useful in one single post, and keeping them alongside the Markdown file is really better for posts management.
For responsive images, I currently use the Jekyll Picture Tag plugin, but:
<picture>
elements, and I "only" needsrcset
andsizes
attributes on most sitesWould it be possible with this plugin, maybe with a new config option?