mirror of
				https://github.com/gohugoio/hugo.git
				synced 2025-11-04 04:27:46 -05:00 
			
		
		
		
	Permalink on Node and Page should be of string
This change fixes #1384.
This commit is contained in:
		
							parent
							
								
									5838420aa1
								
							
						
					
					
						commit
						99acbb2eb2
					
				@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -889,7 +889,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
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@ -1386,11 +1386,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 {
 | 
			
		||||
@ -1572,7 +1572,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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,7 @@ func init() {
 | 
			
		||||
 | 
			
		||||
type AliasPublisher interface {
 | 
			
		||||
	Translator
 | 
			
		||||
	Publish(string, template.HTML) error
 | 
			
		||||
	Publish(string, string) error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type HTMLRedirectAlias struct {
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user