For different posts (generated through rake new_post[my_post]
), I want to add a javascript function that is to be only included in that post, and nowhere else on the blog.
I can do this by hand-editing the public/my_post/index.html
file but then every time I do a rake generate
, I will have to do this again.
Is there a built in way to make this happen in Octopress?
Cheers
In 2.1 you will be able to inject per page/post JavaScript or CSS assets into the header by setting some vars in the yaml front matter.
Currently you can simply insert a link or script tag inside of the post or page itself and it will be loaded in place. Example:
<script type="text/javascript" src="/path/to/file.js"></script>
<link rel="stylesheet" type="text/css" href="/path/to/file.css">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With