Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for option 'collection', which makes this plugin only effect files belonging to a collection, such as the ones created by 'metalsmith-collections' #24

Closed
wants to merge 1 commit into from

Conversation

sanx
Copy link

@sanx sanx commented Nov 6, 2014

I think this is good alternative to setting "permalink: false" in the front matter for people who want to rely more on metalsmith-collections.

…ffect files belonging to a collection, such as the ones created by 'metalsmith-collections'
@sebastienbarre
Copy link

+1, should be merged, very useful (if multiple invocations are supported, which PR #26 seem to confirm).

@misterdai
Copy link

👍 wanted this kind of functionality for a while 😉 #17

@misterdai
Copy link

@ianstormtaylor any chance of this getting merged in?

@timdp
Copy link

timdp commented Nov 2, 2015

What if I want different permalink patterns for different collections, as well as a fallback for other collections? I tried this:

  .use(permalinks({
    collection: 'pages',
    pattern: ':title'
  }))
  .use(permalinks({
    collection: 'blog',
    pattern: ':date/:title'
  }))
  .use(permalinks({
    pattern: ':collection/:title'
  }))

That made it translate pages/about.html to about/index.html (as specified in invocation 1), but it subsequently applied the fallback and unexpectedly went back to pages/about/index.html.

Since the plugin instances are unaware of eachother, would it make sense to somehow flag files that have already been processed? Or perhaps the plugin should take an array of config blocks.

@misterdai
Copy link

@timdp it'd be cool if it'd add a unique key to flag if permalinks have been applied. I'd say .path but I think there are some other metalsmith plugins that also apply that. So if it threw in a ._permalinked = true to the file metadata, then if it's present then permalinks could skip over it.

Otherwise, an array approach would be nice and easily supported alongside the original object approach, to avoid breaking existing usages.

@timdp
Copy link

timdp commented Nov 2, 2015

The array is basically what #26 accomplishes though. That one's working like a treat for me.

@woodyrew
Copy link
Member

Thanks for the PR.

Could you resolve the conflicts or create a new PR based off master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants