import (
"errors"
"fmt"
+ "path/filepath"
"strconv"
"strings"
return helpers.Urlize(p.Title), nil
}
+// pageToPermalinkFilename returns the URL-safe form of the filename
+func pageToPermalinkFilename(p *Page, _ string) (string, error) {
+ var extension = filepath.Ext(p.FileName)
+ var name = p.FileName[0 : len(p.FileName)-len(extension)]
+ return helpers.Urlize(name), nil
+}
+
// if the page has a slug, return the slug, else return the title
func pageToPermalinkSlugElseTitle(p *Page, a string) (string, error) {
if p.Slug != "" {
"section": pageToPermalinkSection,
"title": pageToPermalinkTitle,
"slug": pageToPermalinkSlugElseTitle,
+ "filename": pageToPermalinkFilename,
}
}