Skip to content

Commit 0e16412

Browse files
committed
feat: dynamically created _headers
1 parent 8f0423a commit 0e16412

3 files changed

Lines changed: 24 additions & 10 deletions

File tree

config/_default/hugo.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,25 @@ enableRobotsTXT = true
413413
root = false
414414
ugly = false
415415
weight = 0
416+
[outputFormats.headers]
417+
baseName = '_headers'
418+
isHTML = false
419+
isPlainText = true
420+
mediaType = 'text/plain'
421+
noUgly = false
422+
notAlternative = true
423+
path = ''
424+
permalinkable = false
425+
protocol = ''
426+
rel = 'alternate'
427+
root = true
428+
ugly = false
429+
weight = 0
416430

417431
[outputs]
418432
# JSON output is required for search functionality
419433
# The search index (/index.json) includes only pages from sections defined in params.taxonomies.mainSections
420-
home = ['HTML', 'RSS', 'JSON'] # Ensure JSON is included for search
434+
home = ['HTML', 'RSS', 'JSON', 'headers']
421435
page = ['HTML', 'JSON'] # needed for portfolio.json
422436
rss = ['RSS']
423437
section = ['HTML', 'RSS', 'JSON']

layouts/_default/headers.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
# Content Security Policy to allow Matomo analytics
3+
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' {{ .Site.BaseURL | strings.TrimSuffix "/" }}/analytics http://localhost:8080; connect-src 'self' {{ .Site.BaseURL | strings.TrimSuffix "/" }}/analytics http://localhost:8080; img-src 'self' data: {{ .Site.BaseURL | strings.TrimSuffix "/" }}/analytics http://localhost:8080; style-src 'self' 'unsafe-inline'; font-src 'self' data:
4+
5+
# Security headers
6+
X-Frame-Options: DENY
7+
X-Content-Type-Options: nosniff
8+
X-XSS-Protection: 1; mode=block
9+
Referrer-Policy: strict-origin-when-cross-origin

static/_headers

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)