From e94a222c9cf28be8884867696222296fc710b985 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 14 May 2022 00:58:20 +0200 Subject: Rework robots.txt file --- layouts/robots.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'layouts/robots.txt') diff --git a/layouts/robots.txt b/layouts/robots.txt index 7a24e82..9f95983 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -1,8 +1,12 @@ +{{- $url := urls.Parse site.BaseURL -}} +# robots.txt file for "{{ site.Title }}", {{ $url.Host }} User-agent: * -# robotstxt.org - if ENV production variable is false robots will be disallowed. -{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} +{{- if eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }} Allow: / -Sitemap: {{.Site.BaseURL}}/sitemap.xml -{{ else }} +Sitemap: {{ site.BaseURL }}/sitemap.xml +{{- else }} Disallow: / -{{ end }} +{{- end }} + +# TODO: implement sitemap.xml +# Sitemap: {{ site.BaseURL }}/sitemap.xml -- cgit v1.2.3