Small refactor: don't call p.Permalink() for all aliases, call it only

once and only if necessary.
This commit is contained in:
Alexandre Bourget 2015-12-30 00:47:59 -05:00 committed by Steve Francia
parent 0bb3b49c00
commit dcad066025

View file

@ -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
}