Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-generate _headers file #9173

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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