Build personal blog site with hugo

Show results

In hugo's official website also has instructions on how to build a personal website

Registration github account

Create a github repository

The name of the warehouse must be user name .github.io

Recommended that all lowercase

Install git bash (non-essential, but recommended)

click here

Select the computer corresponding specifications

Step by step installation

To be initialized before using the user name and mailbox

Open the terminal (in powershell example)

Enter the git command, no exceptions can be

Installation hugo

click here

Select the computer corresponding specifications

Download zip archive

Hugo.exe will be unpacked (this is the main)

Create a blog

Open powershell

Go to the folder files are stored hugo.exe (hugo instruction can only be executed in this directory)

If the instruction identified hugo out, you can configure the environment variables

If that does not work, then use the absolute path, until hugo.exe

To start hugo.exe will use. \ Hugo

In hugo.exe storage folder, execute the following code

>hugo new site myblog

myblog own from the name, is an identifier

After generates myblog folder

There have been some things (most of them are necessary to establish the site)

Download theme

click here

Choose a theme download

There are two ways to download

1. Click the download, go to the author github, download zip

Go to the next zip myblog / theme, the need to change the folder names of some

2. On the topic below git clone (This is recommended)

Direct input (be sure to MyBlog cd) in the following powershell

Individual theme download is slow, you can try different places at different times

Downloaded, myblog / theme will be more of a theme corresponding folders (very important)

Here's what should be carried out no matter what kind of

The initial configuration according to the authors wrote in hugo page document (that is, what the theme folder to move out, replaced by something) (very important Without this step, it may be local are not open, crazy error) (but some topics Without this procedure)

Try to open locally

Enter the following code (for example themes to pure) (theme name is the name of the corresponding folder under the theme)

myblog>hugo server -t pure

You will get a local URL

Open the site with a browser

They can see their own web pages in local

LAN users can also see your web page

Push to the server (github pages)

It recommended to the local view, after confirmation pushed to the server

Enter the following code

Be careful not to mistake

myblog>hugo --theme=pure --baseUrl="https://你的用户名.github.io" --buildDrafts

myblog under will generate public folder

Enter the following code

myblog>cd public
public>git init
public>git add .
public>git commit -m "输入你自己的提交信息"
public>git remote add origin https://github.com/用户名/用户名.github.io.git
public>git push -u origin master
public>

This process may need to enter the account number and password github

Access user name .github.io can see your web page

Will be delayed, need wait a minute

Configuration topics and additions

Configuration varies depending on the theme

Through law is carefully read the author's documentation

hugo / or README.md on the theme (visible how important document)

Additions are generally placed content folder, of course, you can also delete content

Generally markdown format

Write markdown can markdownpad / visual studio code / csdn comes, and so on

But found a problem, different editors to preview the effect is not the same

For example markdownpad not well identified latex formula

Possible theme comes with markdown can not exhibit good effect

Update website content

First recommended in local preview, and then upload confirmation

Then execute the following code (including local preview)

myblog>hugo server -t pure
myblog>hugo --theme=pure --baseUrl="https://你的用户名.github.io" --buildDrafts
myblog>cd public
public>git init
public>git add .
public>git commit -m "输入你自己的提交信息"
public>git remote add origin https://github.com/用户名/用户名.github.io.git
public>git pull origin master
public>git push -u origin master
public>

Must write git pull origin master

Delay

Open the user name .github.io can see it has been updated

After updating the website content has been repeating the above operations

=================== The following is a custom domain name (additional content ) =====================
in Ali cloud above the registered account

Real-name system

Buy domain name

The domain name system

Buy SSL Certificates (there are free)

Determine the SSL certificate is valid

The new domain name is connected to a github

Open the corresponding github repository

Custom domain settings are found in

Enter the new domain name

The green √ will be at github pages

Visit the new domain name, you can see the page

After updated content, can be achieved through new domain names

The above operation will take time, be patient and wait

Basic personal blog site set up is completed

Published 25 original articles · won praise 0 · Views 510

Guess you like

Origin blog.csdn.net/qq_43737697/article/details/104539175
Recommended