Skip to content

HUGO_ENV production prevents site from being indexed by Google on AWS #217

@arnonzooz

Description

@arnonzooz

The following code in the header partial will prevent Google from indexing a Docsy based site unless the HUGO_ENV env variable is set to PRODUCTION.

{{ if eq (getenv “HUGO_ENV”) “production” }}
<META NAME=“ROBOTS” CONTENT=“INDEX, FOLLOW”>
{{ else }}
<META NAME=“ROBOTS” CONTENT=“NOINDEX, NOFOLLOW”>
{{ end }}

I'm deploying my site an AWS bucket and so far as I know the env variable cannot be read (https://stackoverflow.com/questions/36226645/configuring-environment-variables-for-static-web-site-on-aws-s3). So I ended up commenting out those lines of code.

Does anyone have experience deploying to AWS and handling the above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions