mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Add embeded template for robots.txt
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
7c5a1fd16b
commit
9a6dc6c791
@@ -34,6 +34,7 @@ hugo
|
||||
-d, --destination="": filesystem path to write files to
|
||||
--disableRSS[=false]: Do not build RSS files
|
||||
--disableSitemap[=false]: Do not build Sitemap file
|
||||
--disableRobotsTXT[=false]: Do not build robots TXT file
|
||||
--editor="": edit new content with this editor, if provided
|
||||
--ignoreCache[=false]: Ignores the cache directory for reading but still writes to it
|
||||
--log[=false]: Enable Logging
|
||||
|
34
docs/content/extras/robots-txt.md
Normal file
34
docs/content/extras/robots-txt.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
date: 2013-07-09
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /community/mailing-list
|
||||
prev: /extras/urls
|
||||
title: Table of Contents
|
||||
weight: 120
|
||||
---
|
||||
|
||||
Hugo can generated customized [robots.txt](http://www.robotstxt.org/) in the
|
||||
[same way than any other template]({{< ref "templates/go-templates.md" >}}).
|
||||
|
||||
By default it generates a robots.txt which allows everything, it looks exactly
|
||||
|
||||
User-agent: *
|
||||
|
||||
To disable it just set `disableRobotsTXT` option to false in the [command line]({{< ref "commands/hugo.md" >}}) or [configuration file]({{< ref "overview/configuration.md" >}}).
|
||||
|
||||
Hugo will use the template `robots.txt` following the list starting with the one with more priority
|
||||
|
||||
* /layouts/robots.txt
|
||||
* /themes/`THEME`/layout/robots.txt
|
||||
|
||||
An example of a robots.txt layout is:
|
||||
|
||||
User-agent: *
|
||||
|
||||
{{range .Data.Pages}}
|
||||
Disallow: {{.RelPermalink}}{{end}}
|
||||
|
||||
|
||||
This template disallows and all the pages of the site creating one `Disallow` entry for each one.
|
@@ -5,7 +5,7 @@ date: 2014-01-03
|
||||
menu:
|
||||
main:
|
||||
parent: extras
|
||||
next: /community/mailing-list
|
||||
next: /extras/robots-txt
|
||||
notoc: true
|
||||
prev: /extras/toc
|
||||
title: URLs
|
||||
|
@@ -96,6 +96,8 @@ Following is a list of Hugo-defined variables that you can configure and their c
|
||||
disableRSS: false
|
||||
# Do not build Sitemap file
|
||||
disableSitemap: false
|
||||
# Do not build robots.txt file
|
||||
disableRobotsTXT: false
|
||||
# edit new content with this editor, if provided
|
||||
editor: ""
|
||||
footnoteAnchorPrefix: ""
|
||||
|
Reference in New Issue
Block a user