Skip to content

Commit

Permalink
docs: create a guide about deploying to Netlify
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jul 14, 2022
1 parent 061e856 commit 1a749b6
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 0 deletions.
32 changes: 32 additions & 0 deletions exampleSite/content/docs/deployment/netlify/index.md
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 exampleSite/content/docs/deployment/netlify/index.zh-cn.md
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 exampleSite/content/docs/deployment/netlify/index.zh-tw.md
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 exampleSite/layouts/shortcodes/code/deployment-netlify-config.html
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

0 comments on commit 1a749b6

Please sign in to comment.