ref: 1823c053c8900cb6ee53b8e5c02939c7398e34dd
parent: 511d5d3b7681cb76822098f430ed6862232ca529
author: Ricardo N Feliciano <[email protected]>
date: Fri Mar 30 10:15:22 EDT 2018
Add .Site.IsServer Fixes #4478
--- a/docs/content/variables/site.md
+++ b/docs/content/variables/site.md
@@ -52,6 +52,9 @@
.Site.IsMultiLingual
: whether there are more than one language in this site. See [Multilingual](/content-management/multilingual/) for more information.
+.Site.IsServer
+: a boolean to indicate if the site is being served with Hugo's built-in server. See [`hugo server`](/commands/hugo_server/) for more information.
+
.Site.Language.Lang
: the language code of the current locale (e.g., `en`).
@@ -122,4 +125,4 @@
<meta name="description" content="{{if .IsHome}}{{ $.Site.Params.description }}{{else}}{{.Description}}{{end}}" />
{{< /code >}}
-[config]: /getting-started/configuration/
\ No newline at end of file
+[config]: /getting-started/configuration/
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -467,6 +467,10 @@
return len(s.Languages) > 1
}
+func (s *SiteInfo) IsServer() bool {
+ return s.owner.running
+}
+
func (s *SiteInfo) refLink(ref string, page *Page, relative bool, outputFormat string) (string, error) {
var refURL *url.URL
var err error