Skip to content

Commit 87f97e5

Browse files
Allow certain pages to not be indexed by SE
Fixes #499
1 parent 5de8db3 commit 87f97e5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ Here is the list of built-in services. Those marked with an `*` are also part of
187187

188188
In order to add an unkown service (absent from the list above), you simply need to add all three settings to `ananke_socials`: name, url, label, color, and optionally add an icon file matching the `name` to the `assets/ananke/socials` directory. In the absence of an icon, the theme will print the service's label.
189189

190+
### Content indexing
191+
192+
If the theme is ran in [production](#production), pages will be indexed by search engines. To prevent indexing on some given pages, add `private: true` to its Front Matter.
193+
190194
### Update font or body classes
191195

192196
The theme is set, by default, to use a near-white background color and the "Avenir" or serif typeface. You can change these in your config file with the `body_classes` parameter, like this:

layouts/_default/baseof.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
1010
{{ hugo.Generator }}
1111
{{/* NOTE: For Production make sure you add `HUGO_ENV="production"` before your build command */}}
12-
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
13-
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
12+
{{ $production := eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }}
13+
{{ $public := not .Params.private }}
14+
{{ if and $production $public }}
15+
<meta name="robots" content="index, follow">
1416
{{ else }}
15-
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
17+
<meta name="robots" content="noindex, nofollow">
1618
{{ end }}
1719

1820
{{ partial "site-style.html" . }}

0 commit comments

Comments
 (0)