Local post assets with Jekyll

后端 未结 6 998
鱼传尺愫
鱼传尺愫 2021-01-30 01:58

I was wondering how other people are organising their assets for individual posts when using Jekyll. For example, if a post has an image, do you just dump it in a shared images

6条回答
  •  醉梦人生
    2021-01-30 03:00

    Just like you, I really hate having all images in one single shared folder.

    Most, if not all, of my images are useful in one single post, and keeping them alongside the Markdown file is really better for posts management:

    • I can drop a new post as one single sub-folder of /_posts/ in one step, without having to put the Markdown at one place and the image(s) at another
    • When I want to edit the image(s) of an existing post, I don't have to find the right image in a huge /assets/ folder, it is located just near the Markdown file
    • In my Markdown, I can use the image file name directly, without any path
    • If I want to use any Markdown editor with live preview, it works, no need for a specific assets folder configuration

    I tried to have this for my blog (example post here).

    For responsive images, I used the Jekyll Picture Tag plugin, but I had to fork it, because the Pull Request to deal with such paths was not accepted.

    Now that Jekyll 3 is there, I wish it could let us use images both in a post folder AND in the /assets/ one, looking for an image marked with ![alt](image-file-without-path.jpg) in both, in that order.

提交回复
热议问题