Closed gkumar9 closed 6 years ago
https://stackoverflow.com/questions/47386295/metalsmith-how-to-have-different-url-generated-for-my-output-pages Anybody respond please. is this repo even active ????
@gkumumar9 Feels a little dead doesn't it? The amount of unmerged PRs is also quite big for a project of this size.
It seems like from the readme, that you can't do this (source code reflects this too). This plugin uses moment.js to parse dates.
As an alternative, you can set metadata on your source files and have front matter like
---
country: usa
city: newyork
borough: manhattan
---
and in your options to permalinks can look like
.use(permalinks({
pattern: ':country/:city/:borough/',
relative: false
}))
Alternatively you could have just one field like date
, but maybe name it something else like location
and have it set as usa-newyork-manhattan
. Then you can use a plugin to to parse out a file's location field and add those properties as part of your file objects. Then you could use the permalink pattern
option to look for those properties to set your file paths.
Also, you might have better luck asking in metalsmith slack channel; metalsmith users are more active there, imo.
@MegaJ your suggestion is accurate. But, my requirement is quite dynamic i.e instead of just having 3 fields i might have 4 or 2 or 8 . You get my point right. Your alternative solution is interesting and useful in regards to dynamicity , but which plugin are you talking about here.
Then you can use a plugin to to parse out a file's location field and add those properties as part of your file objects. Then you could use the permalink pattern option to look for those properties to set your file paths
just as date form this hierarchy,
I want something like below this: