Skip to content

Commit

Permalink
Auto _headers file generation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins committed Jun 20, 2018
1 parent 470f1e5 commit af949d1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
15 changes: 14 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,27 @@ date = ["date", ":filename", "publishDate", "lastmod"]

# Be explicit about the output formats. We (currently) only want an RSS feed for the home page.
[outputs]
home = [ "HTML", "RSS"]
home = [ "HTML", "RSS", "HEADERS" ]
page = [ "HTML"]
section = [ "HTML"]

# Add a "text/netlify" media type for auto-generating the _headers file
[mediaTypes]
[mediaTypes."text/netlify"]
suffix = ""
delimiter = ""

[outputFormats]
[outputFormats.RSS]
baseName = "feed"

# _headers file output (uses the template at layouts/index.headers)
[outputFormats.HEADERS]
mediatype = "text/netlify"
baseName = "_headers"
isPlainText = true
notAlternative = true

[params]

time_format_blog = "Monday, January 02, 2006"
Expand Down
2 changes: 1 addition & 1 deletion netlify_noindex_headers.txt → layouts/index.headers
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Prevent bots from indexing site
/*
X-Robots-Tag: noindex
X-Robots-Tag: noindex
3 changes: 1 addition & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[build]
# This default build command adds the robots noindex directive to the site headers
publish = "public"
command = "hugo && cp netlify_noindex_headers.txt public/_headers"
command = "hugo"

[context.production.environment]
HUGO_BASEURL = "https://kubernetes.io/"
Expand Down

0 comments on commit af949d1

Please sign in to comment.