Refactor current permalink code
Support custom frontmatter data in permalinks