Is it possible to use replace and slicestr in a pipe statement? Per the pipe docs, the single piped value “becomes the last parameter of the next pipeline.”
For example in an archtype I may like to modify the title from the filename of “2012_01_03_post_name.md” to “Post Name”. Ideally I would be able to do this:
Do you happen to know if there is a Hugo syntax roadmap? A quick glance around didn’t reveal any planning documents. Having more (or alternative) pipable functions in the template language would be nice.
slicestr does not check if the first 11 chars are numbers. So why would you need to do that in replaceRE. Also humanize would suit better here, I believe, than manually replacing underscores.
Thanks kaushalmodi! You’re right it doesn’t need to be so complex. I was playing around with capturing syntax for another task and got pulled in! Thanks for the cleaner version. I hadn’t found humanize yet either