mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Permalink on Node and Page should be of string
This change fixes #1384.
This commit is contained in:
parent
5838420aa1
commit
99acbb2eb2
3 changed files with 9 additions and 9 deletions
|
@ -139,7 +139,7 @@ func (n *Node) RelRef(ref string) (string, error) {
|
||||||
|
|
||||||
type URLPath struct {
|
type URLPath struct {
|
||||||
URL string
|
URL string
|
||||||
Permalink template.HTML
|
Permalink string
|
||||||
Slug string
|
Slug string
|
||||||
Section string
|
Section string
|
||||||
}
|
}
|
||||||
|
|
|
@ -889,7 +889,7 @@ func (s *Site) RenderAliases() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.WriteDestAlias(a, template.HTML(plink)); err != nil {
|
if err := s.WriteDestAlias(a, plink); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1386,11 +1386,11 @@ func (s *Site) Stats() {
|
||||||
func (s *Site) setURLs(n *Node, in string) {
|
func (s *Site) setURLs(n *Node, in string) {
|
||||||
n.URL = helpers.URLizeAndPrep(in)
|
n.URL = helpers.URLizeAndPrep(in)
|
||||||
n.Permalink = s.permalink(n.URL)
|
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 {
|
func (s *Site) permalink(plink string) string {
|
||||||
return template.HTML(s.permalinkStr(plink))
|
return s.permalinkStr(plink)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) permalinkStr(plink string) string {
|
func (s *Site) permalinkStr(plink string) string {
|
||||||
|
@ -1572,7 +1572,7 @@ func (s *Site) WriteDestPage(path string, reader io.Reader) (err error) {
|
||||||
return s.PageTarget().Publish(path, reader)
|
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)
|
jww.DEBUG.Println("creating alias:", path)
|
||||||
return s.AliasTarget().Publish(path, permalink)
|
return s.AliasTarget().Publish(path, permalink)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ func init() {
|
||||||
|
|
||||||
type AliasPublisher interface {
|
type AliasPublisher interface {
|
||||||
Translator
|
Translator
|
||||||
Publish(string, template.HTML) error
|
Publish(string, string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type HTMLRedirectAlias struct {
|
type HTMLRedirectAlias struct {
|
||||||
|
@ -107,10 +107,10 @@ func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error
|
||||||
}
|
}
|
||||||
|
|
||||||
type AliasNode struct {
|
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 {
|
if path, err = h.Translate(path); err != nil {
|
||||||
jww.ERROR.Printf("%s, skipping.", err)
|
jww.ERROR.Printf("%s, skipping.", err)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue