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

Use hugo.IsProduction instead of checking HUGO_ENV #653

Merged

Conversation

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 9, 2021
@chalin chalin force-pushed the chalin-hugo-isproduction-take-2-2021-08-09 branch from 62c9baf to 7e2e929 Compare August 19, 2021 13:36
@chalin
Copy link
Collaborator Author

chalin commented Aug 19, 2021

@LisaFC - given that this essentially fixes a "regression" (a previous change that was overwritten by mistake), can it be merged soon? /cc @nate-double-u

@LisaFC
Copy link
Collaborator

LisaFC commented Aug 19, 2021

Yep, I'm just looking at it now - the main thing is that it needs to be documented and announced because it's a breaking change with regard to whether your site is indexed.

(which I didn't think the original change was because I hadn't fully explored the mysterious ways of how the relevant environment variable and the current Hugo environment are not the same thing, as I did in #611)

@chalin
Copy link
Collaborator Author

chalin commented Aug 19, 2021

Thanks. AFAICT, hugo.IsProduction will be true if HUGO_ENV=production is set, so it might not be a breaking change.

@LisaFC
Copy link
Collaborator

LisaFC commented Aug 19, 2021

I think that's true but I need to check, I remember finding some unintuitive behaviour when I explored it in #611

We also need to document for the case where HUGO_ENV=production is not set and the user expects their site not to be indexed - if we make this change it will be indexed unless they explicitly specify that this is a non-production build.

@LisaFC
Copy link
Collaborator

LisaFC commented Aug 19, 2021

Thanks. AFAICT, hugo.IsProduction will be true if HUGO_ENV=production is set, so it might not be a breaking change.

Annoyingly, I just checked, and it isn't (or at least HUGO_ENV=production in your Netlify setup doesn't override setting an environment in your hugo command with -e) - though it shouldn't be a problem anyway for existing sites as users will get a production build by default.

@chalin
Copy link
Collaborator Author

chalin commented Aug 19, 2021

Right, production is the default for the build command. It makes sense that -e takes precedence.

Btw, let me know if there is anything I can do to help.

LisaFC added a commit that referenced this pull request Aug 19, 2021
@LisaFC LisaFC merged commit 8b84765 into google:master Aug 20, 2021
@chalin chalin deleted the chalin-hugo-isproduction-take-2-2021-08-09 branch August 21, 2021 14:31
SpecLad added a commit to SpecLad/cvat that referenced this pull request Jan 24, 2023
Our HTML documentation template slaps a
`<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">` on every page unless
the `HUGO_ENV` environment variable is set to `production`, thereby excluding
the entire documentation website from web search results. Set the variable
to fix it.

This behavior is inherited from Docsy, although they have changed it since:
<google/docsy#653>.
nmanovic pushed a commit to cvat-ai/cvat that referenced this pull request Jan 25, 2023
Our HTML documentation template slaps a `<META NAME="ROBOTS"
CONTENT="NOINDEX, NOFOLLOW">` on every page unless the `HUGO_ENV`
environment variable is set to `production`, thereby excluding the
entire documentation website from web search results. Set the variable
to fix it.

This behavior is inherited from Docsy, although they have changed it
since: <google/docsy#653>.
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Jul 1, 2023
…-ai#5623)

Our HTML documentation template slaps a `<META NAME="ROBOTS"
CONTENT="NOINDEX, NOFOLLOW">` on every page unless the `HUGO_ENV`
environment variable is set to `production`, thereby excluding the
entire documentation website from web search results. Set the variable
to fix it.

This behavior is inherited from Docsy, although they have changed it
since: <google/docsy#653>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changes introducing hugo.IsProduction were overwritten
2 participants