I am aware that you can edit the html/AngularJS that renders the all posts blog homepage on a tumblr blog. But, is there any way to add a custom
When writing a post, on the menu bar where you can click bold, italic, strikethrough, etc, there is a button that says <html>
. If you click this, it will bring up the HTML for the post. Then, all you do is have to add a script tag with the javascript code you want. For example:
<script>
alert("Hello World!");
</script>
NOTE: I believe the javascript will only work when users navigate to your actual page, not when it is in their feed unless the box that is shown to represent extra content is clicked. This is to prevent unnecessary content from showing and keeping load time low in the feed
EDIT: If you want the same javascript to apply to all posts you write, I'd put it into the theme's HTML. To do so you'd go to Customize -> Edit HTML (of the theme) -> put <script> at the bottom of body (generally speaking) or add to an existing <script>
. Each posts has the class .POST
, so use that selector to obtain each. To find out the classes of individual types you can look at the Tumblr API or use inspect element to find out for yourself
NOTE: The script added to the theme will not affect posts in user's feed. It is a change to the theme, thus will not affect individual posts when seen not directly on the site.