Allow placeholders in permalinks
Remove duplicate code
Implement @parkr's suggestions
Merge pull request #3031 from alfredxing/frontmatter-permalinks