11 august 2010

Blogger Template Date Hack

You’ve probably noticed that all the blogger templates stack posts made on a date in to a single bigger post. This is because blogger send’s the date only in the first post of the day.
When i wanted to stop this stacking i found that the only solution on the net is scraping all toghether the post.dateHeader variable and using the post.timestamp instead. I diden’t like that solution because i diden’t wanted to lose a working var. So i figured out another way of doing this using javascript. Basicly we have to save somehow the last date and use it on all the posts. Here is the solution:
<b:if cond='data:post.dateHeader'>
<script>var dh = &#39;<data:post.dateHeader/>&#39;;</script>
<data:post.dateHeader/>
<b:else/>
<script>document.write(dh);</script>
</b:if>
Good luck,

Niciun comentariu:

Trimiteți un comentariu