hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.49k stars 4.86k forks source link

where to put the link files? #658

Closed RNAer closed 10 years ago

RNAer commented 10 years ago

Thanks for the awesome packages at first.

To properly display posts locally with "hexo server", where should the image files of the hyperlinks (assuming the link does not have path before the image file name)?

practicalli-johnny commented 10 years ago

I place image files in `source/images' and then reference them in posts as follows:

{% img images/image-filename.png %}

So if the link to your image does not have a path, then I assume you should place them in the source directory.

I use the source/images' directory as it keeps all the images together and keep thesource` directory easier to manage (assuming you have lots of image files).

Hope that helps.

RNAer commented 10 years ago

thanks!

On Wed, Jun 4, 2014 at 1:30 PM, John Stevenson notifications@github.com wrote:

I place image files in `source/images' and then reference them in posts as follows:

{% img images/image-filename.png %}

So if the link to your image does not have a path, then I assume you should place them in the source directory.

I use the source/images' directory as it keeps all the images together and keep thesource` directory easier to manage (assuming you have lots of image files).

Hope that helps.

— Reply to this email directly or view it on GitHub https://github.com/tommy351/hexo/issues/658#issuecomment-45139876.

floriancargoet commented 10 years ago

You can also use the post_asset_folder: true option in _config.yml I can't find any documentation on it though.

It allows you to store your assets (images for instance) in a directory with same name as your post. If you have 2014/06/my-post.md you can put images in 2014/06/my-post/. After generation, they will be with the index.html of your article :

Example with my blog: https://github.com/floriancargoet/blog.floriancargoet.com/tree/master/source/_posts/2013/03 where I use {% img /2013/03/someone-git-push-force/forced.png %}to reference the images.

practicalli-johnny commented 10 years ago

@RNAer I think this issue can be closed now.

Thanks cc @tommy351

RNAer commented 10 years ago

yeah, thanks all.