working with images

Create the Post with Images

A good practice when starting new posts is to use the “draft” feature. Drafts will not be published by default, so you are free to make changes to other posts while keeping unfinished drafts hidden from public.

1
2
$ hexo new draft "working-with-images"

Inserting images

Images and other asset files can be placed in subdirectories under the ./source/ folder. Use a picture downloaded from google images. In my case, I use Hexo logo. Download the picture into the path below,

1
./source/_images/hexo_logo.png

Edit your draft by adding the code below

1
![Hexo Logo](https://leihuagh.github.io/./images/hexo_logo.png)

Hexo Logo

Publishing Drafts

When it’s time to move the draft to a “live” post for the world to see, use the hexo publish command:

1
$ hexo publish working-with-images

A few things will happen when this command is run:

  • The markdown file My-First-Blog-Post.md moves from ./source/_drafts/ to ./source/_posts.
  • The file’s “front-matter” changes to include a publish date:

Generate the Static File

Finally, prepare the entire site for deployment. Run the hexo generate command:

1
2
$ hexo generate
# generates -> ./public/

Next Steps

  • Update gitHub repository
  • Detail way refer to Getting Start Page