Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
arnonzooz opened this issue Feb 25, 2020 · 8 comments
Closed

Comments

@arnonzooz
Copy link

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?

@LisaFC
Copy link
Collaborator

LisaFC commented Feb 26, 2020

This might be a good issue to raise on the Hugo forums too, as it'll affect sites that use other themes too. I'll see if I can figure anything out in the meantime but I haven't deployed to AWS myself.

@LisaFC
Copy link
Collaborator

LisaFC commented Feb 27, 2020

(do let us know if the Hugo people have any ideas as we can add any workarounds to the docs)

@arnonzooz
Copy link
Author

1 similar comment
@arnonzooz
Copy link
Author

@LisaFC
Copy link
Collaborator

LisaFC commented Feb 28, 2020

Oh great, can you try the solution that bep suggests and if it works we can see about updating the theme.

@arnonzooz
Copy link
Author

Hi, tested it and it seems to work.

Now onto figuring out why Google refuses to fetch Hugo's sitemap :).

@arnonzooz
Copy link
Author

Closing this issue.

@mhansen
Copy link
Contributor

mhansen commented Jun 6, 2021

Hi, I just got bitten by this today on Graphviz and some of our pages are might be unindexed by Google till I redeploy :-(

https://gitlab.com/graphviz/graphviz.gitlab.io/-/issues/99

Above, @LisaFC mentions "if it works we can see about updating the theme", could we reopen this issue (I don't have access) to track updating the theme so that others aren't bitten by this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants