示例#1
0
文件: site.go 项目: h0wn0w/hugo
func (s *Site) initializeSiteInfo() {
	params, ok := viper.Get("Params").(map[string]interface{})
	if !ok {
		params = make(map[string]interface{})
	}

	permalinks, ok := viper.Get("Permalinks").(PermalinkOverrides)
	if !ok {
		permalinks = make(PermalinkOverrides)
	}

	s.Info = SiteInfo{
		BaseUrl:    template.URL(helpers.SanitizeUrl(viper.GetString("BaseUrl"))),
		Title:      viper.GetString("Title"),
		Recent:     &s.Pages,
		Params:     params,
		Permalinks: permalinks,
	}
}
示例#2
0
文件: site.go 项目: johnsto/hugo
func (s *Site) initializeSiteInfo() {
	params := viper.GetStringMap("Params")

	permalinks := make(PermalinkOverrides)
	for k, v := range viper.GetStringMapString("Permalinks") {
		permalinks[k] = PathPattern(v)
	}

	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,
		Menus:           &s.Menus,
		Params:          params,
		Permalinks:      permalinks,
	}
}
示例#3
0
func (s *Site) initializeSiteInfo() {
	params, ok := viper.Get("Params").(map[string]interface{})
	if !ok {
		params = make(map[string]interface{})
	}

	permalinks, ok := viper.Get("Permalinks").(PermalinkOverrides)
	if !ok {
		permalinks = make(PermalinkOverrides)
	}

	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,
		Menus:           &s.Menus,
		Params:          params,
		Permalinks:      permalinks,
	}
}