hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit dcad066025ee8bdb3d0f858b9ea6824fca49cfae
parent 0bb3b49c00536e7dc89773fdc8e985f78d19715d
Author: Alexandre Bourget <alex@bourget.cc>
Date:   Wed, 30 Dec 2015 00:47:59 -0500

Small refactor: don't call `p.Permalink()` for all aliases, call it only
once and only if necessary.

Diffstat:
Mhugolib/site.go | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/hugolib/site.go b/hugolib/site.go
@@ -1060,11 +1060,16 @@ func (s *Site) possibleTaxonomies() (taxonomies []string) {
 // RenderAliases renders shell pages that simply have a redirect in the header
 func (s *Site) RenderAliases() error {
 	for _, p := range s.Pages {
+		if len(p.Aliases) == 0 {
+			continue
+		}
+
+		plink, err := p.Permalink()
+		if err != nil {
+			return err
+		}
+
 		for _, a := range p.Aliases {
-			plink, err := p.Permalink()
-			if err != nil {
-				return err
-			}
 			if err := s.WriteDestAlias(a, plink); err != nil {
 				return err
 			}