Build a blog Based on Hexo and Github and build hexogithub

Source: Internet
Author: User

Build a blog Based on Hexo and Github and build hexogithub

Build your own blog.

Preparations

Make sure that you have downloaded and installed node and npm on your computer. To check whether the installation is successful, you only need to enter the following two commands in the command line for windows.

12 $ Node-v $ npm-v

 

Install hexo
1 $ Npm install-g hexo
Check whether hexo is successfully installed.
1 $ Hexo v

Note: An error may be reported. You can try it.

1 Npm install hexo -- no-optional
Go to the local project directory and initialize hexo
12 $ Cd blog $ hexo init
Install the dependency package in package. json in npm
1 $ Npm install
Generate blog files
1 $ Hexo g
Start a local blog
1 $ Hexo s


Enterhttp://localhost:4000You can access the hexo blog of the default topic.

View hexo help
1 $ Hexo help
Modify the global configuration file

For_congig.ymlModify the configuration.

Website
Parameters Description
title Website title
subtitle Website subtitle
description Website description
author Your name
language Language used by the website
timezone Website time zone. Hexo uses the time zone of your computer by default. Time zone list. For example:America/New_York,Japan, AndUTC.
URL
Parameters Description Default Value
url URL  
root Website root directory  
permalink Permanent Link format of the article :year/:month/:day/:title/
permalink_default Default value of each part of the permanent link
Directory
Parameters Description Default Value
source_dir Resource folder, which is used to store content. source
public_dir Public folder, which is used to store generated site files. public
tag_dir Tag folder tags
archive_dir Archive folder archives
category_dir CATEGORY folder categories
code_dir Include code folder 'Downloads/code
i18n_dir International (i18n) folder :lang
skip_render Skip the rendering of the specified file. You can use the glob expression to match the path.
Article
Parameters Description Default Value
new_post_name File Name of the new article : Title. md
default_layout Preset Layout Post
auto_spacing Add spaces between Chinese and English False
titlecase Convert title to title case False
external_link Open link in new tag True
filename_case Convert the file name to (1) lower case or (2) upper case 0
render_drafts Show draft False
post_asset_folder Start the Asset folder False
relative_link Change the link to the relative address of the root directory. False
future Show future articles True
highlight Code block settings
CATEGORY & tag
Parameters Description Default Value
default_category Default category uncategorized
category_map CATEGORY alias  
tag_map Label alias
Date/time format

Hexo uses Moment. js to parse and display the time.

Parameters Description Default Value
date_format Date Format MMM D YYYY
time_format Time Format H:mm:ss
Paging
Parameters Description Default Value
per_page Number of articles displayed per page (0 = the paging function is disabled) 10
pagination_dir Paging directory page
Extension
Parameters Description
theme The name of the current topic. The value isfalseWhen topic is disabled
deploy Deployment settings
Configure github to create a repository

Generate Test page

Go to the newly created repository, click settings in the upper-right corner, click launch automatic page generator on the jump page, click continue to layouts on the jump page, select the topic, and generate the page. after about 15 minutes, visithttps://syd1992.github.ioTo display the test generation page.

Create an ssh keys
1 $ Ls-al ~ /. Ssh

1 $ Ssh-keygen-t rsa-C "847909475@qq.com"

After you enter the command, you will be prompted to enter the ssh keys storage location. Generally, you do not need to change it. Press enter directly. Then, you will be prompted to enter the password and then be sure to enter the password again. This password will be used later,Remember!

1 $ Cat ~ /. Ssh/id_rsa.pub

Add ssh keys to the github Repository

Test connection

Run the command, enter the command, ask yes/no, enter yes, and prompt to enter the password, enter the password set when generating the ssh keys

1 $ Ssh-T git@github.com

The following message is displayed, indicating that the operation is successful.

1 Hi, user name/user name. github. io! You 've successfully authenticated, but GitHub does notprovide shell access.
Configure and release the _ config. yml file in the root directory
1 $ Npm install hexo-deployer-git -- save

1 $ Hexo g
1 $ Hexo d

Accesshttps://syd192.github.io.gitYou can see your hard work !!

Switch topic

The default topic is landscape. If you do not like it, visit here to get more topics. I chose TKL as the topic. The specific switching method is as follows:

1 $ Git clone https://github.com/SuperKieran/TKL.git theme/TKL

Then,hexo g, Againhexo d.

Note: Fill in the image url. the img folder should be placed in the source file directory, and the url can be directly written as/img/image .png.

Write a blog
1 $ Hexo new "newBlog"

Then,hexo g, Againhexo d.

Finally, let's look at the results chart and continue to cheer up ~~~~

Reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.