metalsmith / permalinks

A Metalsmith plugin for permalinks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] aftert or before metalsmith-markdown?

jsomedon opened this issue · comments

I am not sure if it's even a bug.. So if I do

.use(permalinks())
.use(markdown())

files don't get remapped. Well if I call markdown first then it works. Here are my questions:

  1. I assumed all permalinks do is telling metalsmith that "you should output to dir specified in pattern", then metalsmith would place to that dir when .build() is called, so it doesn't matter to tell metalsmith the output dir before or after md files are parsed?
  2. I aussmed all YAML key value pairs would be ready at the very beginning of plugin chain? Or no? That's why we rely on markdown to parse YAML as well so permalinks can use them with pattern?

so I wonder is it really necessary to remap stuff after markdown is converted to html?

Hi, this sort of discussion is better suited to the Metalsmith Slack Channels but I'll give a brief answer here.
Metalsmith plugins are inherently designed to be independent and used in whichever order is the most appropriate to get the desired output.
For example, I run permalinks pretty much last to only change files from my-file.html to my-file/index.html so the url can be /my-file

I forgot to say, the problem in your case of running permalinks first is probably because markdown is expecting a .md file.
I'm going to close the issue but if you need more help, ping me on Slack or re-open the issue.