Change hexo blog theme - NexT
Change to hexo blog theme NexT which has neat look and supports a lot cool features.
Download the theme
1 | $ git clone https://github.com/iissnan/hexo-theme-next themes/next |
Edit blog configuration file _config.yml, change to theme from the default langscape to next
1 | theme: next |
Edit theme configuration file themes/next/_config.yml, change list scheme from default Muse to Pisces, see more about NexT theme scheme
1 | # Schemes |
I prefer the scheme Pisces because it has menu and links and other stuff showing on left side of the blog content.
Add blog owner avatar
I’d like my avatar showing up in my blog, and I have avatar uploaded to my github account.
Locate the avatar image link of my github account, mine is https://avatars0.githubusercontent.com/u/34552097
Edit blog configuration file _config.yml, add a line in # Site section
1 | avatar: https://avatars0.githubusercontent.com/u/34552097 |
Create categories page, tags page, and about page
create categories page
1 | $ hexo new page "categories" |
Edit source/categories/index.md, set page type to “categories”, change title to “Categories”
1 | title: Categories |
create tags page
1 | $ hexo new page "tags" |
Edit source/tags/index.md, set type to “tags”, change title to “Tags”
create about page
1 | $ hexo new page "about" |
Edit source/about/index.md, change title to “About me”, and add description of about myself.
1 | --- |
Edit theme configuration file themes/next/_config.yml, enable categories, tags, and about menu.
1 | menu: |
Edit the post source/_post/1st-blog.md, add categories and tags
1 | title: 1st blog |
Enable social links
Edit theme configuration file, themes/next/_config.yml, enable social links, change icons_only from false to true.
1 | social: |
Add RSS
Install hexo-generator-feed plugin
1 | $ npm install hexo-generator-feed --save |
Edit blog configuration file _config.yml
1 | type: atom |
Adding image to blog post
I’d like the image for a blog post to be in a blog post specific folder, so I enabled the “post_asset_folder”
Edit blog configuration file _config.yml
1 | post_asset_folder: true |
When I do “hexo new ‘My 1st blog’”, a blog specific asset folder named “My-1st-blog” will be created under source/_post along with the post markdown file My-1st-blog.md .
Copy the image file ‘penguins.png’ to source/_post/My-1st-blog
Edit source_post/My-1st-blog.md, reference the image in the markdown file like this
1 | This is my first blog post. |
Enable post comment with disqus
Sign up https://disqus.com/, you can sign up with twitter, facebook, or google account. On next step, choose “I want to install Disqus on my site”, mark the shortname of the site. My shortname is annax
NexT theme already supports disqus, edit theme configuration theme/next/_config.yml
1 | disqus: |
Then each blog post, and about page, and tags page will have adding comment embeded below the content.
If you want to disable comment for specific page or post, add “comments: false” to post/page front-matter
For me, I disable comment for tags page.
Page and site view count
Enable busuanzi_count in theme next configuration file, edit theme/next/_config.yml
1 | busuanzi_count: |
Then the blog home page will have site view count at the bottom and each post page will have post view count at the bottom.
Enable local search
Install hexo-generator-searchdb plugin
1 | $ npm install hexo-generator-searchdb --save |
Edit blog configuration file _config.yml, add
1 | search: |
Edit theme configuration file theme/next/_config.yml
1 | local_search: |
Then the blog menu will have a “search” button
Tips
If the blog is too long and you don’t want the whole blog content show in the blog home page, add a line to blog post markdown file where you want to insert a “Read more” button.
1 | <!--more--> |