code: func (l PermalinkExpander) pageToPermalinkFilename(p Page, _ string) (string, error) {
  	name := p.File().TranslationBaseName()
  	if name == "index" {
  		// Page bundles; the directory name will hopefully have a better name.
  		dir := strings.TrimSuffix(p.File().Dir(), helpers.FilePathSeparator)
  		_, name = filepath.Split(dir)
  	}
  
  	return l.ps.URLize(name), nil
  }
docs: // pageToPermalinkFilename returns the URL-safe form of the filename