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

The plugin should ignore files with empty metadata ? #22

Closed
jocelynlecomte opened this issue Sep 17, 2014 · 1 comment
Closed

The plugin should ignore files with empty metadata ? #22

jocelynlecomte opened this issue Sep 17, 2014 · 1 comment
Milestone

Comments

@jocelynlecomte
Copy link

In my case, the metalsmith-permalinks plugin runs after other plugins which are adding to my
homepage (/index.html) some YAML metadata this way:

- collection: []
- filename: index

and the pattern is ':collection/:filename'. The result is that the homepage is moved to /index/index.html because the replace(pattern, data, options) function finds all the metadata it needs, even though the metadata is empty.

I managed to make it work by adding

- permalink: false

to my homepage.

Maybe I'm wrong, but I wonder if the permalinks plugin should consider 'empty metadata' just like 'no metadata'

@webketje
Copy link
Member

webketje commented May 2, 2022

With v2.4.0 optional path parts became available.
That means the current results reflect pattern :collection?/:filename rather than :collection/:filename.
If optional path parts are indicated by a question mark, all other path parts are required.
At present, the plugin considers missing required path parts empty strings and processes and outputs the file anyway.

Ideally permalinks would log a warning that a matched file misses a path parameter value.
Maybe it should also throw an error, or it should silently ignore the file.But definitely writing it to a probably unexpected location by the user is not the best default case.

@webketje webketje added this to the 3.0.0 milestone Aug 4, 2022
@webketje webketje mentioned this issue Aug 4, 2022
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants