Disable LiveReload when Hugo is not running as a server
authorKato Kazuyoshi <kato.kazuyoshi@gmail.com>
Thu, 15 Oct 2015 06:27:57 +0000 (23:27 -0700)
committerspf13 <steve.francia@gmail.com>
Thu, 15 Oct 2015 20:36:14 +0000 (16:36 -0400)
This change fixes #1410.

hugolib/site.go

index 4cf31e4ab3d000467f43c3cb1c289ca91146794a..743cc082663b5e7da9c6c62220a739f0b7e2ae31 100644 (file)
@@ -1449,7 +1449,7 @@ func (s *Site) renderAndWritePage(name string, dest string, d interface{}, layou
                transformLinks = append(transformLinks, transform.AbsURL)
        }
 
-       if viper.GetBool("watch") && !viper.GetBool("DisableLiveReload") {
+       if s.Running() && viper.GetBool("watch") && !viper.GetBool("DisableLiveReload") {
                transformLinks = append(transformLinks, transform.LiveReloadInject)
        }