From a1e764ece6576b0070f750d37255e39ebbc2c5cd Mon Sep 17 00:00:00 2001 From: Geo Date: Tue, 28 Jun 2022 19:34:26 +0100 Subject: [PATCH] refactor: split out Netlify module Creates dedicated module for Netlify deployment: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify See #2754 --- modules/wowchemy-plugin-netlify/README.md | 21 +++++++++++++++++++ modules/wowchemy-plugin-netlify/config.yaml | 19 +++++++++++++++++ modules/wowchemy-plugin-netlify/go.mod | 3 +++ .../src}/layouts/index.headers | 0 .../src}/layouts/index.redirects | 0 modules/wowchemy/config.yaml | 15 ------------- 6 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 modules/wowchemy-plugin-netlify/README.md create mode 100644 modules/wowchemy-plugin-netlify/config.yaml create mode 100644 modules/wowchemy-plugin-netlify/go.mod rename modules/{wowchemy => wowchemy-plugin-netlify/src}/layouts/index.headers (100%) rename modules/{wowchemy => wowchemy-plugin-netlify/src}/layouts/index.redirects (100%) diff --git a/modules/wowchemy-plugin-netlify/README.md b/modules/wowchemy-plugin-netlify/README.md new file mode 100644 index 00000000..e62251f2 --- /dev/null +++ b/modules/wowchemy-plugin-netlify/README.md @@ -0,0 +1,21 @@ +# Wowchemy Plugin for Netlify + +A build plugin to integrate your Hugo site seamlessly with Netlify. + +The plugin automatically generates a `_headers` and `_redirects` file at the root of the public folder to configure [HTTP headers](https://www.netlify.com/docs/headers-and-basic-auth/) and [redirects](https://www.netlify.com/docs/redirects/) on Netlify. + +By default, the plugin will help secure your site with some common security headers. You can easily add or replace headers through the plugin config. + +## Install + +1. Edit `config/_default/config.yaml` to install the `wowchemy-plugin-netlify` module: + + ```yaml + module: + imports: + - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify + ``` + +## Configure + +- 📚 [View the **documentation**](https://wowchemy.com/docs/hugo-tutorials/security/) diff --git a/modules/wowchemy-plugin-netlify/config.yaml b/modules/wowchemy-plugin-netlify/config.yaml new file mode 100644 index 00000000..979573a8 --- /dev/null +++ b/modules/wowchemy-plugin-netlify/config.yaml @@ -0,0 +1,19 @@ +module: + mounts: + - source: src/layouts + target: layouts +mediaTypes: + text/netlify: + delimiter: '' + suffixes: [''] +outputFormats: + headers: + baseName: _headers + isPlainText: true + mediatype: text/netlify + notAlternative: true + redirects: + baseName: _redirects + isPlainText: true + mediatype: text/netlify + notAlternative: true diff --git a/modules/wowchemy-plugin-netlify/go.mod b/modules/wowchemy-plugin-netlify/go.mod new file mode 100644 index 00000000..f1637a5f --- /dev/null +++ b/modules/wowchemy-plugin-netlify/go.mod @@ -0,0 +1,3 @@ +module github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify + +go 1.15 diff --git a/modules/wowchemy/layouts/index.headers b/modules/wowchemy-plugin-netlify/src/layouts/index.headers similarity index 100% rename from modules/wowchemy/layouts/index.headers rename to modules/wowchemy-plugin-netlify/src/layouts/index.headers diff --git a/modules/wowchemy/layouts/index.redirects b/modules/wowchemy-plugin-netlify/src/layouts/index.redirects similarity index 100% rename from modules/wowchemy/layouts/index.redirects rename to modules/wowchemy-plugin-netlify/src/layouts/index.redirects diff --git a/modules/wowchemy/config.yaml b/modules/wowchemy/config.yaml index 1f47853b..49eeefc2 100644 --- a/modules/wowchemy/config.yaml +++ b/modules/wowchemy/config.yaml @@ -16,21 +16,6 @@ markup: tableOfContents: startLevel: 2 endLevel: 3 -mediaTypes: - text/netlify: - delimiter: '' - suffixes: [''] -outputFormats: - headers: - baseName: _headers - isPlainText: true - mediatype: text/netlify - notAlternative: true - redirects: - baseName: _redirects - isPlainText: true - mediatype: text/netlify - notAlternative: true sitemap: changefreq: weekly module: