Add Disqus support out of the box. Move template/bundle into hugolib.

This commit is contained in:
spf13
2014-04-23 02:52:01 -04:00
parent 41adafbc3e
commit 4a8de8ea46
7 changed files with 57 additions and 39 deletions

View File

@@ -27,7 +27,6 @@ import (
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/source"
"github.com/spf13/hugo/target"
"github.com/spf13/hugo/template/bundle"
"github.com/spf13/hugo/transform"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/nitro"
@@ -57,7 +56,7 @@ var DefaultTimer *nitro.B
// 5. The entire collection of files is written to disk.
type Site struct {
Pages Pages
Tmpl bundle.Template
Tmpl Template
Taxonomies TaxonomyList
Source source.Input
Sections Taxonomy
@@ -72,19 +71,20 @@ type Site struct {
}
type SiteInfo struct {
BaseUrl template.URL
Taxonomies TaxonomyList
Indexes *TaxonomyList // legacy, should be identical to Taxonomies
Recent *Pages
Title string
Author string
AuthorEmail string
LanguageCode string
Copyright string
LastChange time.Time
ConfigGet func(key string) interface{}
Permalinks PermalinkOverrides
Params map[string]interface{}
BaseUrl template.URL
Taxonomies TaxonomyList
Indexes *TaxonomyList // legacy, should be identical to Taxonomies
Recent *Pages
Title string
Author map[string]string
LanguageCode string
DisqusShortname string
Copyright string
LastChange time.Time
ConfigGet func(key string) interface{}
Permalinks PermalinkOverrides
Params map[string]interface{}
}
}
type runmode struct {
@@ -130,7 +130,7 @@ func (s *Site) Analyze() {
}
func (s *Site) prepTemplates() {
s.Tmpl = bundle.NewTemplate()
s.Tmpl = NewTemplate()
s.Tmpl.LoadTemplates(s.absLayoutDir())
if s.hasTheme() {
s.Tmpl.LoadTemplatesWithPrefix(s.absThemeDir()+"/layouts", "theme")
@@ -234,16 +234,16 @@ func (s *Site) initializeSiteInfo() {
permalinks = make(PermalinkOverrides)
}
s.Info = SiteInfo{
BaseUrl: template.URL(helpers.SanitizeUrl(viper.GetString("BaseUrl"))),
Title: viper.GetString("Title"),
Author: viper.GetString("author"),
AuthorEmail: viper.GetString("authoremail"),
LanguageCode: viper.GetString("languagecode"),
Copyright: viper.GetString("copyright"),
Recent: &s.Pages,
Params: params,
Permalinks: permalinks,
s.Info = &SiteInfo{
BaseUrl: template.URL(helpers.SanitizeUrl(viper.GetString("BaseUrl"))),
Title: viper.GetString("Title"),
Author: viper.GetStringMapString("author"),
LanguageCode: viper.GetString("languagecode"),
Copyright: viper.GetString("copyright"),
DisqusShortname: viper.GetString("DisqusShortname"),
Recent: &s.Pages,
Params: params,
Permalinks: permalinks,
}
}