Hugo quickly build Blog
1 installation
-
Binary installation is recommended (simple and fast)
Download the Hugo binaries (hugo or hugo.exe) of the corresponding operating system version from Hugo Releases
Hugo Releases:h t tp s: / / g i th ub. Com / go h ug oi o/ hu go / r e l ea s e s
This article takes Windows as an example, so download: hugo_0.24.1_Windows-64bit.zip
After downloading, extract to get the "hugo.exe" file.
Add the directory where hugo.exe is located under the system environment variable PATH, open cmd, and enter "hugo version".
2 create a site & articles
-
To create a site, a command is done, change to the directory where you want to create the site, and type:
D:\ git > hugo new site blogCongratulations! Your new Hugo site is created in D:\ git\ blog.Just a few more steps and you're ready to go:1. Download a theme into the same-named folder. Choose a theme from https://themes.gohugo.io/, or create your own with the "hugo new theme" command.2. Perhaps you want to add some content. You can add single files with "hugo new\." .3. Start the built-in live server via "hugo server". Visit https://gohugo.io/ for quickstart guide and full documentation.
A blog site is created. The new site directory results as follows:
Blog/ archetypes/ doc/ content/ data/ layouts/ static/ config.toml
The current site does not have any content and does not have any configuration.
Next, change to the blog site directory and create an article:
D:\ git > cd blogD:\ git\ blog > hugo new about.md
The file is located in the blog/content/about.md directory. Open the edit:
+ + date = "2017-07-03T15:37:11+08:00" tags = ["blog"] title = "my first blog" + + # here markdown is used to write articles
Markdown tutorial: ht tp: / / w ow ub u nt u .co m / markdown /
3 installation theme
-
The site must have a theme, and installing a theme should be the most difficult step, because different theme settings will be different.
Hugo themes:h t t ps: / / themes .g o h ugo. Io/
You can go to the website above to choose your favorite theme. Then, follow the instructions to find the github project address to download.
3.1 download topic:
The theme I use is: ht t ps: / / gi t hu b. Co m / w d / hu g o-f a b r i c
Clone the theme via git or download it directly to the local area. Put into... / blog/themes/ directory.
3.2 use themes:
Generate a topic resource file (hugo-fabric is the topic name)
D:\ git\ blog > hugo- t hugo-fabricStarted building sites... Built site for language en:0 of 3 drafts rendered0 future content0 expired content8 regular pages created12 other pages created0 non-page files copied2 paginator pages created1 tags created1 categories createdtotal in 35 ms
Replace\ blog\ themes\ hugo-fabric\ exampleSite\ config.toml with\ blog\ config.toml
Note: the config.toml file is the core, most of the configuration of the website needs to be modified, and the configuration of each theme is not exactly the same.
4 start the server
-
D:\ git\ blog > hugo serverWARNING: Site config's rssURI is deprecated and will be removed in a future release. Set baseName in outputFormats.RSS.Started building sites... Built site for language en:0 draft content0 future content0 expired content1 regular pages created8 other pages created0 non-page files copied1 paginator pages created1 tags created0 categories createdtotal in 9 msWatching for changes in D:\ git\ blog\ {data,content,layouts,static,themes} Serving pages from memoryWeb Server is available at http://localhost:1313/ (bind address 127.0.0.1) Press Ctrl+C to stop
Open a browser to access: http://localhost:1313/