$hugonewsitehugoblogCongratulations!YournewHugositeiscreatedinD:\hugoblog.Justafewmorestepsandyou're ready to go:1.Downloadathemeintothesame-namedfolder.Chooseathemefromhttps://themes.gohugo.io/orcreateyourownwiththe"hugo new theme <THEMENAME>"command.2.Perhapsyouwanttoaddsomecontent.Youcanaddsinglefileswith"hugo new <SECTIONNAME>\<FILENAME>.<FORMAT>".3.Startthebuilt-inliveservervia"hugo server".Visithttps://gohugo.io/forquickstartguideandfulldocumentation.hg@LAPTOP-G8TUFE0TMINGW64/d$cdhugoblog/hg@LAPTOP-G8TUFE0TMINGW64/d/hugoblog$lsarchetypes/config.tomlcontent/data/layouts/public/static/themes/hg@LAPTOP-G8TUFE0TMINGW64/d/hugoblog
hg@LAPTOP-G8TUFE0T MINGW64 /d/hugoblog
$ hugo new posts/first.md
Content "D:\\hugoblog\\content\\post\\first.md" created
hg@LAPTOP-G8TUFE0T MINGW64 /d/hugoblog
$ echo "i love you,xyy hurt!" >> content/post/first.md
🍀 说明
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
hugo new [路径]文章名.md
hugo new会创建包含默认元数据的文章,如果没有路径, 文章会保存在content目录中。
md的文章会在开始部分添加元数据,
数据格式为 yaml toml json格式如下:
+++
title = "my first blog"
date = "2019-10-28T09:38:35+08:00"
draft = true
+++
markdownz正文部分>>>
PS:
draft=true表示文章默认为草稿
draft=false 才能识别非草稿
4.本地预览
1
2
3
4
5
$ hugo server -v -D
#hugo -d 目标路径
不指定目标路径, 会默认在public目录下生成可部署的网站.
我们通过hugo server -D本地生成网站预览. 他会监控页面的更改, 并刷新页面.