Skip to content

Commit

Permalink
Permalink on Node and Page should be of string
Browse files Browse the repository at this point in the history
This change fixes gohugoio#1384.
  • Loading branch information
kzys committed Oct 17, 2015
1 parent 0c66ad8 commit f6a05b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hugolib/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (n *Node) RelRef(ref string) (string, error) {

type URLPath struct {
URL string
Permalink template.HTML
Permalink string
Slug string
Section string
}
Expand Down
10 changes: 5 additions & 5 deletions hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ func (s *Site) RenderAliases() error {
if err != nil {
return err
}
if err := s.WriteDestAlias(a, template.HTML(plink)); err != nil {
if err := s.WriteDestAlias(a, plink); err != nil {
return err
}
}
Expand Down Expand Up @@ -1380,11 +1380,11 @@ func (s *Site) Stats() {
func (s *Site) setURLs(n *Node, in string) {
n.URL = helpers.URLizeAndPrep(in)
n.Permalink = s.permalink(n.URL)
n.RSSLink = s.permalink(in + ".xml")
n.RSSLink = template.HTML(s.permalink(in + ".xml"))
}

func (s *Site) permalink(plink string) template.HTML {
return template.HTML(s.permalinkStr(plink))
func (s *Site) permalink(plink string) string {
return s.permalinkStr(plink)
}

func (s *Site) permalinkStr(plink string) string {
Expand Down Expand Up @@ -1566,7 +1566,7 @@ func (s *Site) WriteDestPage(path string, reader io.Reader) (err error) {
return s.PageTarget().Publish(path, reader)
}

func (s *Site) WriteDestAlias(path string, permalink template.HTML) (err error) {
func (s *Site) WriteDestAlias(path string, permalink string) (err error) {
jww.DEBUG.Println("creating alias:", path)
return s.AliasTarget().Publish(path, permalink)
}
Expand Down
6 changes: 3 additions & 3 deletions target/htmlredirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func init() {

type AliasPublisher interface {
Translator
Publish(string, template.HTML) error
Publish(string, string) error
}

type HTMLRedirectAlias struct {
Expand Down Expand Up @@ -107,10 +107,10 @@ func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error
}

type AliasNode struct {
Permalink template.HTML
Permalink string
}

func (h *HTMLRedirectAlias) Publish(path string, permalink template.HTML) (err error) {
func (h *HTMLRedirectAlias) Publish(path string, permalink string) (err error) {
if path, err = h.Translate(path); err != nil {
jww.ERROR.Printf("%s, skipping.", err)
return nil
Expand Down

0 comments on commit f6a05b2

Please sign in to comment.