Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd .Site.IsServer to determine if the site was built in server mode #4478
Comments
bep
added this to the v0.38 milestone
Mar 7, 2018
bep
assigned
bep
and unassigned
bep
Mar 7, 2018
bep
added
the
Enhancement
label
Mar 7, 2018
bep
changed the title
Please add feature to distinguish, in a template, when Hugo server is running
Add .Site.IsServer to determine if the site was built in server mode
Mar 7, 2018
bep
modified the milestones:
v0.38,
v0.39
Mar 20, 2018
This comment has been minimized.
This comment has been minimized.
But isn't this already possible by simply checking if |
This comment has been minimized.
This comment has been minimized.
Not if you run your server with something other than "localhost". I do that all the time. You could, of course, adjust that logic to also check for that hostname, but that would hardly be very portable. |
felicianotech
referenced this issue
Mar 27, 2018
Merged
Add .Site.Info.IsServer flag when using built-in Hugo server. #4541
bep
closed this
in
#4541
Mar 30, 2018
added a commit
that referenced
this issue
Mar 30, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mydoghasworms commentedMar 7, 2018
As per the following Discourse discussion:
https://discourse.gohugo.io/t/disable-portions-of-content-while-developing/10860
It would be helpful to put a condition into a template that can determine whether the page is being built/server by
hugo server
(and not necessarily with the-D
flag, for which there is already a variable).This would be helpful for the case where you want to test the site in its final form (no drafts) but want to switch off, e.g. analytics or ads.