Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/danielkvist/hugo-piercer-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielkvist <d94.zaragoza@gmail.com>2019-04-03 11:22:50 +0300
committerdanielkvist <d94.zaragoza@gmail.com>2019-04-03 12:16:07 +0300
commit54d5ebd51ccfd52e181a2dbcf2091866db3f561a (patch)
treeb1efe136f1d9a7fcaf89de8876c4c44772554e89
parentc843957fe86c34544ba558c312f3d1cfcf26d501 (diff)
add robots.txt and sitemap.xml template
-rw-r--r--README.md3
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/robots.txt1
-rw-r--r--layouts/sitemap.xml24
4 files changed, 28 insertions, 1 deletions
diff --git a/README.md b/README.md
index 7fcc772..0c83836 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,8 @@ baseurl = "/" # The base URL of your Hugo site
title = "titlehere" # The title of your Hugo site
author = "authorhere" # The author name
googleAnalytics = "" # Your Google Analytics tracking ID
-defaultContentLanguage = "en"
+enableRobotsTXT = true
+defaultContentLanguage = "en"
language = "en-US"
paginate = 7 # The numbers of posts per page
theme = "piercer" # Your Hugo theme
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 6e0e245..b765fae 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -2,6 +2,7 @@ baseurl = "/"
title = "Piercer"
author = "Daniel Zaragoza (Danielkvist)"
googleAnalytics = ""
+enableRobotsTXT = true
defaultContentLanguage = "en"
language = "en-US"
paginate = 3
diff --git a/layouts/robots.txt b/layouts/robots.txt
new file mode 100644
index 0000000..4f9540b
--- /dev/null
+++ b/layouts/robots.txt
@@ -0,0 +1 @@
+User-agent: * \ No newline at end of file
diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml
new file mode 100644
index 0000000..feecd15
--- /dev/null
+++ b/layouts/sitemap.xml
@@ -0,0 +1,24 @@
+{{ $items := (where .Data.Pages "Params.menu" "main") }}
+
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
+
+ {{ range $items }}
+ <url>
+ <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
+ <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
+ <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
+ <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
+ <xhtml:link
+ rel="alternate"
+ hreflang="{{ .Lang }}"
+ href="{{ .Permalink }}"
+ />{{ end }}
+ <xhtml:link
+ rel="alternate"
+ hreflang="{{ .Lang }}"
+ href="{{ .Permalink }}"
+ />{{ end }}
+ </url>
+ {{ end }}
+
+</urlset> \ No newline at end of file