Quickly Build and Deploy a News Website Using Hugo
与动态网站相比,静态网站包含固定内容,每个访问者看到的都是相同的页面。具有建设成本低,发布渠道广泛等优势。
Hugo 是一个用于构建网站的开源静态网站生成器。
使用包管理工具安装Hugo:例如在Windows终端中,使用winget
安装:
安装完毕后,重启终端,运行如下命令查看是否安装成功:
从官网下载Git,按照默认设置安装即可。
安装文本编辑器,以便完成对内容的编辑。推荐使用VS Code编辑器。
可以通过命令或者编辑器创建新闻内容。
可以使用Markdown语法继续内容的标注。
#
进行标记![]()
这样的语法进行标记<style>
.meta-media {
position: relative;
margin-bottom: 30px;
display: flex;
width: 100%;
height: 0;
padding-bottom: 75%;
}
.video {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
</style>
<div class="meta-media">
<iframe src="{{ .Get "src" }}&high_quality=1" frameborder="no" scrolling="yes" allowfullscreen="allowfullscreen" high_quality="1" framespacing="1" class="video" >
</iframe>
</div>
---
title: "Ananke: a Hugo Theme"
description: "The last theme you'll ever need. Maybe."
# 1. To ensure Netlify triggers a build on our exampleSite instance, we need to change a file in the exampleSite directory.
theme_version: '2.8.2'
cascade:
featured_image: '/images/gohugo-default-sample-hero-image.jpg'
---
Welcome to my blog with some of my work in progress. I've been working on this book idea. You can read some of the chapters below.
languageCode = 'zh'
theme = 'ananke'
title = '搞个大新闻网'
[[menu.main]]
identifier = "home"
name = "Home"
url = "/"
weight = 10
[[menu.main]]
identifier = "post"
name = "Posts"
url = "/posts/"
weight = 20
[markup]
defaultMarkdownHandler = "goldmark"
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
为自己的团队、社团、项目建立新闻网站,并持续维护。