Skip to content

Commit

Permalink
Add .Site.IsServer
Browse files Browse the repository at this point in the history
Fixes #4478
  • Loading branch information
FelicianoTech authored and bep committed Mar 30, 2018
1 parent 511d5d3 commit 1823c05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/content/variables/site.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).

Expand Down Expand Up @@ -122,4 +125,4 @@ You can use `.Site.Params` in a [partial template](/templates/partials/) to call
<meta name="description" content="{{if .IsHome}}{{ $.Site.Params.description }}{{else}}{{.Description}}{{end}}" />
{{< /code >}}

[config]: /getting-started/configuration/
[config]: /getting-started/configuration/
4 changes: 4 additions & 0 deletions hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1823c05

Please sign in to comment.