added option to redirect to baseurl

This commit is contained in:
Gabriele Musco 2021-01-19 10:08:51 +01:00
parent 9566d4e75f
commit f2e2af6f92
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,11 @@ paginate = 5 # number of articles per page in the index
dimForegroundColor = "#bababa"
strokeColor = "#4f4f4f"
accentColor = "#db5793"
# redirect to baseURL if current URL host doesn't match
# useful if deploying in gitlab pages with custom domain and don't want
# the username.gitlab.io/website url to persist
forceRedirect = false
```
## Inject custom content

View File

@ -1,4 +1,9 @@
<head>
{{ if .Site.Params.forceRedirect }}
<script>
if (location.host != new URL("{{ .Site.BaseURL }}").host) location.href = "{{ .Site.BaseURL }}"
</script>
{{ end }}
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=7">