code: func (s *Site) renderAliases() error {
  	for _, p := range s.workAllPages {
  
  		if len(p.Aliases()) == 0 {
  			continue
  		}
  
  		for _, of := range p.OutputFormats() {
  			if !of.Format.IsHTML {
  				continue
  			}
  
  			plink := of.Permalink()
  			f := of.Format
  
  			for _, a := range p.Aliases() {
  				isRelative := !strings.HasPrefix(a, "/")
  
  				if isRelative {
  					// Make alias relative, where "." will be on the
  					// same directory level as the current page.
  					// TODO(bep) ugly URLs doesn't seem to be supported in
  					// aliases, I'm not sure why not.
  					basePath := of.RelPermalink()
  					if strings.HasSuffix(basePath, "/") {
  						basePath = path.Join(basePath, "..")
  					}
  					a = path.Join(basePath, a)
  
  				} else if f.Path != "" {
  					// Make sure AMP and similar doesn't clash with regular aliases.
  					a = path.Join(f.Path, a)
  				}
  
  				lang := p.Language().Lang
  
  				if s.h.multihost && !strings.HasPrefix(a, "/"+lang) {
  					// These need to be in its language root.
  					a = path.Join(lang, a)
  				}
  
  				if err := s.writeDestAlias(a, plink, f, p); err != nil {
  					return err
  				}
  			}
  		}
  	}
  
  	return nil
  }
docs: // renderAliases renders shell pages that simply have a redirect in the header.