Which is better? YOU DECIDE
# toml
[build]
command = "npm run build"
publish = "build"
functions = "functions-build"
[[headers]]
for = "/baz"
[headers.values]
X-Frame-Options = "DENY"
[[headers]]
for = "/*"
[headers.values]
Cache-Control= "no-cache, no-store, must-revalidate"
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
Link = '''
</style1.css>; rel=preload; as=stylesheet, \
</style2.css>; rel=preload; as=stylesheet, \
</style3.css>; rel=preload; as=stylesheet'''
[[redirects]]
from = "/*"
to = "/.netlify/functions/do-login"
status = 302
force = true
query = {site = ":site"}
conditions = {Role = ["admin"]}
[[redirects]]
from = "/foo"
to = "/bar"
status = 200 |
# yml
build:
command: npm run build
publish: build
functions: functions-build
headers:
- for: /baz
values:
X-Frame-Options: DENY
- for: /*
values:
Cache-Control: no-cache, no-store, must-revalidate
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Link: |
</style1.css>; rel=preload; as=stylesheet,
</style2.css>; rel=preload; as=stylesheet,
</style3.css>; rel=preload; as=stylesheet
redirects:
- from: /*
to: /.netlify/functions/do-login
status: 302
force: true
query: {site = ":site"}
conditions: { Role: [admin] }
- from: /foo
to: /bar
status: 200
force: true |
P.s. TOML can't handle brackets in double quotes...
https://hitchdev.com/strictyaml/why-not/toml/