From c4a89d14eda51dd03879dec71df6838675ee0ab1 Mon Sep 17 00:00:00 2001 From: Queensferry Date: Thu, 31 Mar 2022 20:46:30 +0800 Subject: feat: add robots.txt --- layouts/_default/index.html | 57 --------------------------------------------- layouts/_default/rss.xml | 45 ----------------------------------- layouts/index.html | 57 +++++++++++++++++++++++++++++++++++++++++++++ layouts/robots.txt | 2 ++ layouts/rss.xml | 45 +++++++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+), 102 deletions(-) delete mode 100644 layouts/_default/index.html delete mode 100644 layouts/_default/rss.xml create mode 100644 layouts/index.html create mode 100644 layouts/robots.txt create mode 100644 layouts/rss.xml diff --git a/layouts/_default/index.html b/layouts/_default/index.html deleted file mode 100644 index 5cc7583..0000000 --- a/layouts/_default/index.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - {{ partial "head.html" . }} - - - - -
- {{ partial "header.html" . }} -
- {{ $paginator := .Paginate (where .Site.RegularPages "Type" "==" "post") }} - {{ range $paginator.Pages }} -
-

- {{ .Title }} - -

- {{ if ne .Params.tags nil }} -
- Keywords: - {{ range .Params.tags }} - #{{ . }} - {{ end }} -
- {{ end }} -
- {{ if .Site.Params.enableHanEmph }} - {{ .Summary | replaceRE "(\\p{Han}+?)" "$1" | safeHTML }} - {{ else }} - {{ .Summary }} - {{ end }} -
-
- {{ end }} - {{ if or $paginator.HasPrev $paginator.HasNext}} -
- {{ if $paginator.HasPrev }} - ← prev - {{ else }} - - {{ end }} - {{ if $paginator.HasNext }} - next → - {{ else }} - - {{ end }} -
- {{ end }} -
- {{ partial "footer.html" . }} -
- {{ partial "foot.html" . }} - - - diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml deleted file mode 100644 index 5fe60fc..0000000 --- a/layouts/_default/rss.xml +++ /dev/null @@ -1,45 +0,0 @@ - - -{{- $pctx := . -}} -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} -{{- $pages := slice -}} -{{- if or $.IsHome $.IsSection -}} -{{- $pages = $pctx.RegularPages -}} -{{- else -}} -{{- $pages = $pctx.Pages -}} -{{- end -}} -{{- $limit := .Site.Config.Services.RSS.Limit -}} -{{- if ge $limit 1 -}} -{{- $pages = $pages | first $limit -}} -{{- end -}} -{{- printf "" | safeHTML }} - - - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .Permalink }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} - {{.}}{{end}}{{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} - {{- with .OutputFormats.Get "RSS" -}} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{- end -}} - {{ range $pages }} - - {{ .Title }} - {{ .Permalink }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} - {{ .Permalink }} - {{ if .Site.Params.enableFullRSS }} - {{ .Content | html }} - {{ else }} - {{ .Summary | html }} - {{ end }} - - {{ end }} - - diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..5cc7583 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,57 @@ + + + + + {{ partial "head.html" . }} + + + + +
+ {{ partial "header.html" . }} +
+ {{ $paginator := .Paginate (where .Site.RegularPages "Type" "==" "post") }} + {{ range $paginator.Pages }} +
+

+ {{ .Title }} + +

+ {{ if ne .Params.tags nil }} +
+ Keywords: + {{ range .Params.tags }} + #{{ . }} + {{ end }} +
+ {{ end }} +
+ {{ if .Site.Params.enableHanEmph }} + {{ .Summary | replaceRE "(\\p{Han}+?)" "$1" | safeHTML }} + {{ else }} + {{ .Summary }} + {{ end }} +
+
+ {{ end }} + {{ if or $paginator.HasPrev $paginator.HasNext}} +
+ {{ if $paginator.HasPrev }} + ← prev + {{ else }} + + {{ end }} + {{ if $paginator.HasNext }} + next → + {{ else }} + + {{ end }} +
+ {{ end }} +
+ {{ partial "footer.html" . }} +
+ {{ partial "foot.html" . }} + + + diff --git a/layouts/robots.txt b/layouts/robots.txt new file mode 100644 index 0000000..e89778e --- /dev/null +++ b/layouts/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Sitemap: {{ "sitemap.xml" | absURL }} diff --git a/layouts/rss.xml b/layouts/rss.xml new file mode 100644 index 0000000..5fe60fc --- /dev/null +++ b/layouts/rss.xml @@ -0,0 +1,45 @@ + + +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ if .Site.Params.enableFullRSS }} + {{ .Content | html }} + {{ else }} + {{ .Summary | html }} + {{ end }} + + {{ end }} + + -- cgit v1.2.3