Add tpl/site and tpl/hugo

This means that the current `.Site` and ´.Hugo` is available as a globals, so you can do `site.IsServer`, `hugo.Version` etc.

Fixes #5470
Fixes #5467
Fixes #5503
This commit is contained in:
Bjørn Erik Pedersen
2018-11-26 10:11:22 +01:00
parent 514e18dc27
commit 831d23cb4d
35 changed files with 518 additions and 162 deletions

View File

@@ -27,6 +27,8 @@ import (
"unicode"
"unicode/utf8"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/hugofs"
"github.com/spf13/afero"
@@ -324,7 +326,7 @@ func InitLoggers() {
// plenty of time to fix their templates.
func Deprecated(object, item, alternative string, err bool) {
if err {
DistinctErrorLog.Printf("%s's %s is deprecated and will be removed in Hugo %s. %s", object, item, CurrentHugoVersion.Next().ReleaseVersion(), alternative)
DistinctErrorLog.Printf("%s's %s is deprecated and will be removed in Hugo %s. %s", object, item, hugo.CurrentVersion.Next().ReleaseVersion(), alternative)
} else {
// Make sure the users see this while avoiding build breakage. This will not lead to an os.Exit(-1)