Auto _headers file generation logic (#9225)
This commit is contained in:
committed by
k8s-ci-robot
parent
4e0858f2d5
commit
bf4b9377e6
+25
-3
@@ -34,14 +34,27 @@ blog = "/:section/:year/:month/:day/:slug/"
|
|||||||
|
|
||||||
# Be explicit about the output formats. We (currently) only want an RSS feed for the home page.
|
# Be explicit about the output formats. We (currently) only want an RSS feed for the home page.
|
||||||
[outputs]
|
[outputs]
|
||||||
home = [ "HTML", "RSS"]
|
home = [ "HTML", "RSS", "HEADERS" ]
|
||||||
page = [ "HTML"]
|
page = [ "HTML"]
|
||||||
section = [ "HTML"]
|
section = [ "HTML"]
|
||||||
|
|
||||||
|
# Add a "text/netlify" media type for auto-generating the _headers file
|
||||||
|
[mediaTypes]
|
||||||
|
[mediaTypes."text/netlify"]
|
||||||
|
suffix = ""
|
||||||
|
delimiter = ""
|
||||||
|
|
||||||
[outputFormats]
|
[outputFormats]
|
||||||
[outputFormats.RSS]
|
[outputFormats.RSS]
|
||||||
baseName = "feed"
|
baseName = "feed"
|
||||||
|
|
||||||
|
# _headers file output (uses the template at layouts/index.headers)
|
||||||
|
[outputFormats.HEADERS]
|
||||||
|
mediatype = "text/netlify"
|
||||||
|
baseName = "_headers"
|
||||||
|
isPlainText = true
|
||||||
|
notAlternative = true
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
time_format_blog = "Monday, January 02, 2006"
|
time_format_blog = "Monday, January 02, 2006"
|
||||||
@@ -67,6 +80,17 @@ githubbranch = "v1.11.0"
|
|||||||
docsbranch = "release-1.11"
|
docsbranch = "release-1.11"
|
||||||
url = "https://kubernetes.io"
|
url = "https://kubernetes.io"
|
||||||
|
|
||||||
|
[params.pushAssets]
|
||||||
|
css = [
|
||||||
|
"callouts",
|
||||||
|
"styles",
|
||||||
|
"custom-jekyll/tags"
|
||||||
|
]
|
||||||
|
js = [
|
||||||
|
"custom-jekyll/tags",
|
||||||
|
"script"
|
||||||
|
]
|
||||||
|
|
||||||
[[params.versions]]
|
[[params.versions]]
|
||||||
fullversion = "v1.10.3"
|
fullversion = "v1.10.3"
|
||||||
version = "v1.10"
|
version = "v1.10"
|
||||||
@@ -95,7 +119,6 @@ githubbranch = "v1.7.6"
|
|||||||
docsbranch = "release-1.7"
|
docsbranch = "release-1.7"
|
||||||
url = "https://v1-7.docs.kubernetes.io"
|
url = "https://v1-7.docs.kubernetes.io"
|
||||||
|
|
||||||
|
|
||||||
# Language definitions.
|
# Language definitions.
|
||||||
|
|
||||||
[languages]
|
[languages]
|
||||||
@@ -112,4 +135,3 @@ languageName ="Chinese"
|
|||||||
weight = 2
|
weight = 2
|
||||||
contentDir = "content/cn"
|
contentDir = "content/cn"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
{{- $cssFilesFromConfig := .Site.Params.pushAssets.css -}}
|
||||||
|
{{- $jsFilesFromConfig := .Site.Params.pushAssets.js -}}
|
||||||
|
{{- $pages := .Site.RegularPages -}}
|
||||||
|
/*
|
||||||
|
X-Robots-Tag: noindex
|
||||||
|
Link: </images/favicon.png>; rel=preload; as=image
|
||||||
|
{{- range $cssFilesFromConfig -}}
|
||||||
|
{{- $cssUrl := printf "/css/%s.css" . }}
|
||||||
|
Link: <{{ $cssUrl }}>; rel=preload; as=style
|
||||||
|
{{- end -}}
|
||||||
|
{{- range $jsFilesFromConfig -}}
|
||||||
|
{{- $jsUrl := printf "/js/%s.js" . }}
|
||||||
|
Link: <{{ $jsUrl }}>; rel=preload; as=script
|
||||||
|
{{- end -}}
|
||||||
|
{{- range $pages }}
|
||||||
|
{{- if or (.Params.deprecated) (eq .Params.class "gridPage") (.Params.case_study_styles) (.Params.css) (.Params.js) }}
|
||||||
|
{{ .URL }}
|
||||||
|
{{- if .Params.deprecated }}
|
||||||
|
Link: </css/deprecation-warning.css>; rel=preload; as=style
|
||||||
|
{{- end -}}
|
||||||
|
{{- if eq .Params.class "gridPage" }}
|
||||||
|
Link: </css/gridpage.css>; rel=preload; as=style
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Params.case_study_styles }}
|
||||||
|
Link: </css/case_study_styles.css>; rel=preload; as=style
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Params.css -}}
|
||||||
|
{{- range (split . ",") }}
|
||||||
|
Link: <{{ trim . " " }}>; rel=preload; as=style
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Params.js -}}
|
||||||
|
{{- range (split . ",") }}
|
||||||
|
Link: <{{ trim . " " }}>; rel=preload; as=script
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
[build]
|
[build]
|
||||||
# This default build command adds the robots noindex directive to the site headers
|
|
||||||
publish = "public"
|
publish = "public"
|
||||||
command = "hugo --enableGitInfo && cp netlify_noindex_headers.txt public/_headers"
|
command = "hugo"
|
||||||
|
|
||||||
[context.production.environment]
|
[context.production.environment]
|
||||||
HUGO_BASEURL = "https://kubernetes.io/"
|
HUGO_BASEURL = "https://kubernetes.io/"
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Prevent bots from indexing site
|
|
||||||
/*
|
|
||||||
X-Robots-Tag: noindex
|
|
||||||
Reference in New Issue
Block a user