shithub: hugo

Download patch

ref: 24c1770288803bd7a344f5903dd4f03cccc6a8f0
parent: b7ed67d425524717d3cafdde9a5ce3cb92defdc6
author: Bjørn Erik Pedersen <[email protected]>
date: Sat Mar 25 15:21:19 EDT 2017

hugolib: Revise paginator alias path handling

--- a/helpers/path.go
+++ b/helpers/path.go
@@ -358,23 +358,6 @@
 	return name, nil
 }
 
-// PaginateAliasPath creates a path used to access the aliases in the paginator.
-func (p *PathSpec) PaginateAliasPath(base string, page int) string {
-	paginatePath := p.paginatePath
-	uglify := p.uglyURLs
-	var pth string
-	if base != "" {
-		pth = filepath.FromSlash(fmt.Sprintf("/%s/%s/%d", base, paginatePath, page))
-	} else {
-		pth = filepath.FromSlash(fmt.Sprintf("/%s/%d", paginatePath, page))
-	}
-	if uglify {
-		pth += ".html"
-	}
-
-	return pth
-}
-
 // GuessSection returns the section given a source path.
 // A section is the part between the root slash and the second slash
 // or before the first slash.
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -122,12 +122,15 @@
 		paginatePath := s.Cfg.GetString("paginatePath")
 
 		// write alias for page 1
-		// TODO(bep) ml all of these n.addLang ... fix.
-		//TODO(bep) output fix
+		addend := fmt.Sprintf("/%s/%d", paginatePath, 1)
+		target, err := p.createTargetPath(p.outputFormat, addend)
+		if err != nil {
+			return err
+		}
 
-		aliasPath := p.addLangPathPrefix(s.PathSpec.PaginateAliasPath(path.Join(p.sections...), 1))
-		link := p.Permalink()
-		s.writeDestAlias(aliasPath, link, nil)
+		// TODO(bep) output do better
+		link := newOutputFormat(p.Page, p.outputFormat).Permalink()
+		s.writeDestAlias(target, link, nil)
 
 		pagers := p.paginator.Pagers()