TLDR: Issue is #4558, proposed fix pull request #5267.
In brief, the problem is that single files and leaf bundles are currently not being handled the same way by the :filename
frontmatter config.
I have implemented a simple fix by adding a ContentBaseName
-field to the file data structure, and made sure that this is set to the file base name for single files and to the folder name for a leaf bundle. As far as I can tell, this solves the problem at hand without any adverse effects, so the only question is whether I have missed a more elegant solution.
Does anybody have a suggestion for a cleaner/more general implementation, or any suggestions for changes to the current implementation (my first go code ever)?
A related discussion seems to be this one on how to retrieve parent folder names in page bundles (which should also be handled by my fix).
Cheers
Janus
Input as leaf bundle: No date/slug from filename
.
└── blog
└── 2018-03-02-FILE-name
└── index.md
Input as single file: Date/slug from filename works ok.
.
└── blog
└── 2018-03-02-FILE-name.md