Add .Site.IsServer - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 1823c053c8900cb6ee53b8e5c02939c7398e34dd
DIR parent 511d5d3b7681cb76822098f430ed6862232ca529
HTML Author: Ricardo N Feliciano <FelicianoTech@gmail.com>
Date: Fri, 30 Mar 2018 14:15:22 -0400
Add .Site.IsServer
Fixes #4478
Diffstat:
M docs/content/variables/site.md | 6 ++++--
M hugolib/site.go | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
---
DIR diff --git 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
<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/
DIR diff --git 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