mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-14 06:17:20 +00:00
refactor: rename modules and update migration docs
BREAKING CHANGE Module paths moved to `github.com/HugoBlox/kit` with new names: - core `blox-tailwind` → `blox` - analytics → `analytics` - netlify → `integrations/netlify` - slides (reveal) → `slides` Update go.mod, module.yaml/params, scripts, tests, and v0.11 migration guide accordingly.
This commit is contained in:
1 parent
e7e0c714d3
commit
f4280ddb1c
566 files changed
+134
-151
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# Hugo 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 Netlify integration module:
|
||||
|
||||
```yaml
|
||||
module:
|
||||
imports:
|
||||
- path: github.com/HugoBlox/kit/modules/integrations/netlify
|
||||
```
|
||||
|
||||
2. Tell Hugo to generate the Netlify `headers` and `redirects` files by adding them to Hugo's `outputs` config. For example,
|
||||
|
||||
```yaml
|
||||
outputs:
|
||||
home: [..., headers, redirects]
|
||||
```
|
||||
|
||||
## Configure
|
||||
|
||||
- 📚 [View the **documentation**](https://docs.hugoblox.com/hugo-tutorials/security/)
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
module github.com/HugoBlox/kit/modules/integrations/netlify
|
||||
|
||||
go 1.15
|
||||
@@ -0,0 +1,26 @@
|
||||
{{- $csp_policy := site.Params.hugoblox.security.csp.policy | default "" -}}
|
||||
{{- $csp_report_only := site.Params.hugoblox.security.csp.report_only | default false -}}
|
||||
{{- $frame_options := site.Params.hugoblox.security.frame_options | default "sameorigin" -}}
|
||||
{{- $default_perms := "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()" -}}
|
||||
{{- $permissions_policy := site.Params.hugoblox.security.permissions_policy | default $default_perms -}}
|
||||
# Netlify headers
|
||||
# Automatically generated
|
||||
# Documentation: https://docs.hugoblox.com/hugo-tutorials/security/
|
||||
/*
|
||||
{{- if eq $frame_options "allow" -}}
|
||||
{{/* No X-Frame-Options header - allows all origins */}}
|
||||
{{- else if eq $frame_options "sameorigin" -}}
|
||||
X-Frame-Options: SAMEORIGIN
|
||||
{{- else -}}
|
||||
X-Frame-Options: DENY
|
||||
{{- end -}}
|
||||
X-XSS-Protection: 1; mode=block
|
||||
X-Content-Type-Options: nosniff
|
||||
Strict-Transport-Security: max-age=31536000; includeSubDomains
|
||||
Referrer-Policy: strict-origin-when-cross-origin
|
||||
{{with $csp_policy}}Content-Security-Policy{{if $csp_report_only}}-Report-Only{{end}}: {{replaceRE "(\\s\\s+)" " " (trim . " ")}}{{end}}
|
||||
{{with $permissions_policy}}Permissions-Policy: {{replaceRE "(\\s\\s+)" " " (trim . " ")}}{{end}}
|
||||
/index.webmanifest
|
||||
Content-Type: application/manifest+json
|
||||
/index.xml
|
||||
Content-Type: application/rss+xml
|
||||
@@ -0,0 +1,9 @@
|
||||
# Netlify redirects
|
||||
# Automatically generated
|
||||
# Documentation: https://docs.netlify.com/routing/redirects/
|
||||
{{- /* Note: code purposely un-indented to preserve required spacing in output. */ -}}
|
||||
{{- range $page := where site.AllPages ".Aliases" "!=" nil -}}
|
||||
{{- range $page.Aliases }}
|
||||
{{ .|relLangURL }} {{ $page.RelPermalink -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
Reference in new issue
Block a user