# Encrypted: don't peep inside!

### How to set password for blogs.

There are several hexo plugins for post encrypting. After checking out some of them, I found this node.js package quite good.(others may work, though I found them somewhat confusing)

You can either choose to follow the tutorial on https://npmjs.com or to follow mine. I have found out some deficiencies of the plugin, however, and have come up with some solutions, so you may want to see my suggestions.

## Installation

The installation is quite simple:

• Under your root directory for hexo blog, run npm install

Note that before running npm install, you need to check there are no other uninstalled package names inside package.json, or they will also be installed.

## Configuration

In your _config.yml file, add these lines:

Then in the front matter of your post, you will also have to add these lines:

## Problems

There is one problem with this plugin. While it will encrypt its content and thumbnail, sometimes on the sidebar of your blog webpage your thumbnail will still show. For example, in theme Hueman, your thumbnail will show in the “RECENTS” column.

On the other hand, Normally we would like our post to be beautiful even though it is encrypted. The better solution for this is to explicitly enable a thumbnail that can be shown. Basically this plugin works to encrypt all data(assets) of your post. However, if we use pictures placed outside this post’s asset folder, we will be able to display it correctly.

In your /sources folder, create a subfolder named images, and then use thumbnail: /images/thumbnail.jpg in your front matter. When the site is generated, the picture will be exactly stored in that path, which will not be encrypted. This way, you will be able to keep your beautiful thumbnail just as I did here!

However, this plugin(as of 10/2017) only supports the encryption of posts, not pages for hexo. To see a difference between hexo post and page, visit this page.

Share