diff --git a/docs/content/variables/site.md b/docs/content/variables/site.md index 00b1d20e7..f0c041ecb 100644 --- a/docs/content/variables/site.md +++ b/docs/content/variables/site.md @@ -52,6 +52,9 @@ The following is a list of site-level (aka "global") variables. Many of these va .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 @@ You can use `.Site.Params` in a [partial template](/templates/partials/) to call {{< /code >}} -[config]: /getting-started/configuration/ \ No newline at end of file +[config]: /getting-started/configuration/ diff --git a/hugolib/site.go b/hugolib/site.go index c3e2d9cb0..7d67cf218 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -467,6 +467,10 @@ func (s *SiteInfo) IsMultiLingual() bool { 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