Check out example codes for "Hugo Robots.txt template". It will help you in understanding the concepts better.

Code Example 1

User-agent: *

Disallow: /disclaimer/
Disallow: /partners/
Allow: /
Allow: /contact/
Allow: /blog/
{{ range where .Site.RegularPages "Type" "blog" }}
Allow: {{.RelPermalink}}
{{end}}
Sitemap: {{ .Sitemap.Filename | default "sitemap.xml" | absURL }}`

Code Example 2

In layouts/robots.txt

User-agent: *

{{range .Pages}}
Disallow: {{.RelPermalink}}
{{end}}

Learn ReactJs, React Native from akashmittal.com