ruby on rails - Jekyll auto-generated titles from file names -
i write files like:
ideas.md
social-pomodoro.md
ynm.md
and not have write titles, eg:
--- title: ideas ---
but titles should generated filenames using similar rails #humanize
method.
as isn't built-in functionality of jekyll (at time of writing), suppose have 2 options:
- write post, , use
{{ post.path }}
tag , manipulate path filename , save post title.
this require write frontmatter , other post details. here's related question.
- (recommended) use script generate filename based on title.
this similar reverse of wanted, in script take in parameters such post title , post tags, , generate file correct jekyll post filename (name-of-post-2015-01-30) (i think jekyll posts need dates avoid collisions). script generate appropriate yaml front matter can writing right away , not deal repetitive overhead. all have like ./post.sh "title" "optional_tags
, you're go!
here python script written josh branchadu creates file details dates , filenames taken care of. there's similar bash version well. lastly a script uses thor ruby in automating jekyll posts should let create post in painless way possible.
Comments
Post a Comment