-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: create a guide about deploying to Netlify
- Loading branch information
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
+++ | ||
# type = "docs" | ||
title = "Deploy to Netlify" | ||
linkTitle = "Netlify" | ||
date = 2022-07-12T14:20:49+08:00 | ||
# description = "" # Used by description meta tag, summary will be used instead if not set or empty. | ||
featured = false | ||
draft = false | ||
comment = true | ||
toc = true | ||
reward = true | ||
pinned = false | ||
carousel = false | ||
categories = ["Deployment"] | ||
tags = ["Netlify"] | ||
series = ["Docs"] | ||
images = [] | ||
+++ | ||
|
||
This article shows how to deploy your site to [Netlify](https://www.netlify.com/). | ||
|
||
<!--more--> | ||
|
||
## Netlify Configuration | ||
|
||
Create a `netlify.toml` in the site root: | ||
|
||
```toml | ||
{{% code/deployment-netlify-config %}} | ||
``` | ||
|
||
> See also [Starter Template Netlify Configuration](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/netlify.toml). |
32 changes: 32 additions & 0 deletions
32
exampleSite/content/docs/deployment/netlify/index.zh-cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
+++ | ||
# type = "docs" | ||
title = "部署于 Netlify" | ||
linkTitle = "Netlify" | ||
date = 2022-07-12T14:20:49+08:00 | ||
# description = "" # Used by description meta tag, summary will be used instead if not set or empty. | ||
featured = false | ||
draft = false | ||
comment = true | ||
toc = true | ||
reward = true | ||
pinned = false | ||
carousel = false | ||
categories = ["部署"] | ||
tags = ["Netlify"] | ||
series = ["文档"] | ||
images = [] | ||
+++ | ||
|
||
本文将介绍如何部署站点于 [Netlify](https://www.netlify.com/)。 | ||
|
||
<!--more--> | ||
|
||
## Netlify Configuration | ||
|
||
于根目录创建 `netlify.toml` 文件: | ||
|
||
```toml | ||
{{% code/deployment-netlify-config %}} | ||
``` | ||
|
||
> 也可以参考[新手模板 Netlify Configuration](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/netlify.toml)。 |
32 changes: 32 additions & 0 deletions
32
exampleSite/content/docs/deployment/netlify/index.zh-tw.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
+++ | ||
# type = "docs" | ||
title = "部署於 Netlify" | ||
linkTitle = "Netlify" | ||
date = 2022-07-12T14:20:49+08:00 | ||
# description = "" # Used by description meta tag, summary will be used instead if not set or empty. | ||
featured = false | ||
draft = false | ||
comment = true | ||
toc = true | ||
reward = true | ||
pinned = false | ||
carousel = false | ||
categories = ["部署"] | ||
tags = ["Netlify"] | ||
series = ["文檔"] | ||
images = [] | ||
+++ | ||
|
||
本文將介紹如何部署站點於 [Netlify](https://www.netlify.com/)。 | ||
|
||
<!--more--> | ||
|
||
## Netlify Configuration | ||
|
||
於根目錄創建 `netlify.toml` 文件: | ||
|
||
```toml | ||
{{% code/deployment-netlify-config %}} | ||
``` | ||
|
||
> 也可以參考[新手模板 Netlify Configuration](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/netlify.toml)。 |
32 changes: 32 additions & 0 deletions
32
exampleSite/layouts/shortcodes/code/deployment-netlify-config.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[build] | ||
publish = "public" | ||
|
||
[build.environment] | ||
NODE_VERSION = "17.6.0" | ||
HUGO_VERSION = "0.101.0" | ||
HUGO_ENABLEGITINFO = "true" | ||
GO_VERSION = "1.17.7" | ||
|
||
[context.production] | ||
command = "npm install && hugo --minify" | ||
|
||
[context.production.environment] | ||
HUGO_ENV = "production" | ||
|
||
[[headers]] | ||
for = "/*" | ||
[headers.values] | ||
Referrer-Policy = "strict-origin-when-cross-origin" | ||
X-Content-Type-Options = "nosniff" | ||
X-Frame-Options = "deny" | ||
X-XSS-Protection = "1; mode=block" | ||
|
||
[[redirects]] | ||
from = "/:lang/*" | ||
to = "/:lang/404.html" | ||
status = 404 | ||
|
||
[[redirects]] | ||
from = "/*" | ||
to = "/en/404.html" # Replace the "en" to your default language code if "defaultContentLanguageInSubdir" is enabled, otherwise use "/404.html" instead. | ||
status = 404 |