Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hexo change folder structure when generate static files

First of all, thanks Hexo. Here is my question:

I set post_asset_folder to true in the Hexo configuration file. Then I run:

$ hexo new first.

then:

$ ls source/_posts/

first/ first.md hello-world.md

I added a pic named pic.png into source/_posts/first and wrote something in source/_posts/first.md like the following:

title: first

date: 2015-06-16 13:42:29

tags:

---

picture blow ^_^

![pic](first/pic.png)

Then:

$ hexo g

$ hexo s

I open http://0.0.0.0:4000/, but i coundn't see the content of pic.png.

I checked the folder public/2015/06/16/first/. I found there is some diffrience between folder public/2015/06/16/ and folder source/_posts/.

  1. structure of folder public/2015/06/16/
.
└── public/2015/06/16/
    ├── first
    │   ├── pic.png
    │   └── first.md
    └── hello-world
        └── hello-world.md
  1. structure of folder source/_posts/
.
└── source/_posts/
    ├── first
    │   ├── first
    │   │   └── pic.png
    │   └── first.md
    └── hello-world
        └── hello-world.md 

How can i unify the path format that i could get same path in markdowm and index.html.

like image 549
seekkAn Avatar asked Nov 09 '22 11:11

seekkAn


1 Answers

You can (sadly) not display an image in your markdown editor of choice and the rendered HTML file. To make it work in in the rendered version, you have to address it like this: ![](cat.jpg).

  1. Set post_asset_folder: true in _config.yml
  2. Create new post with hexo new post "Some New Post"
  3. Place image in source/_posts/Some-New-Post/, e.g. source/_posts/Some-New-Post/cat.jpg
  4. Display image in post with ![](cat.jpg)
like image 139
Pwdr Avatar answered Dec 23 '22 07:12

Pwdr