Hexo with Image Hosting
Preface
Sometimes, I might need to insert images into a blog post. The pain point I had earlier is storing image somewhere and copy that path inside the blog post in an organized manner. After some research online, I decided to use an image hosing service (imgur) with a VS Code extension (picGo) to faciliate the upload and link generation process.
Imgur Registration
After registering an account with imgur, we can go to this page to get a Client ID
for uploading images with PicGo extension later. In case the link does not work, follow instructions on Imgur API Documentation page.
On the Register an Application
page for imgur, remember to choose the OAuth 2 authorization without a callback URL
(Red box in the screenshot below), because we do not need the callback URL.

Also remember to fill in other mandatory information on the page as well, the Application Name
is for your referrence only, I put PicGo
.
After registering an application, keep the Client ID
somewhere safe, it is needed for configuration in PicGo extension.
PicGo Extension
After installing the extension in VS Code, we need to configure it. Like changing default Pic Bed
to imgur
and add Client ID
generated earlier to Imgur: Client ID
. Changed configuration looks like below in VS Code json format:
1 | "picgo.picBed.imgur.clientId": "xxx", |
Usage
For uploading an image in VS Code:
- Copy the image to be uploaded by
Cmd
+C
(orCtrl
+C
for Windows/Linux) Cmd
+Opt
+U
(orCtrl
+Alt
+U
for Windows/Linux) to upload an image from clipboard- VS Code will prompt a message about uploading image, and a link like

will be inserted once the upload is done
Issues - Huge Image
Normally I might need to upload some screenshots, and they have quite high resolutions, hence the image inserted takes a lot space, which reduces the reading experience. I found hexo supports html img tag.
1 | <img src="https://link" alt="display text when link died" width="40%" height="40%"> |
PicGo extension also supports Custom Output Format
. For me I changed the output format to <img src="${url}" alt="${uploadedName}" width="" height="">
.
However, this type of markdown syntax conflicts with markdownlint’s MD033-Inline HTML. To allow img
tag for this rule, change markdownlint config like below.
1 | "markdownlint.config": { |