First, make a backup copy of your template.
Open your template.
Locate:
<b:if cond="data:mobile == "false"">
<!-- posts -->
Just below replace this code (there may be small differences in your template but the block is this):
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<data:defaultAdStart/>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.isDateStart'>
<b:if cond='data:post.isFirstPost == "false"'>
</div></div>
</b:if>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-outer">
</b:if>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'><span><data:post.dateHeader/></span></h2>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-posts">
</b:if>
<div class='post-outer'>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "static_page"'>
<b:include data='post' name='comment_picker'/>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comment_picker'/>
</b:if>
</div>
<b:if cond='data:post.includeAd'>
<b:if cond='data:post.isFirstPost'>
<data:defaultAdEnd/>
<b:else/>
<data:adEnd/>
</b:if>
<div class='inline-ad'>
<data:adCode/>
</div>
<data:adStart/>
</b:if>
</b:loop>
<b:if cond='data:numPosts != 0'>
</div></div>
</b:if>
<data:adEnd/>
</div>
with:
<b:if cond='data:mobile == "false"'>
<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<data:defaultAdStart/>
<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast == "true"'>
<b:if cond='data:label.name != "computer"'>
<div class='date-header'>
<h2 class='date-header'>
<script type='text/javascript'>var ssyby='<data:post.dateHeader/>';</script>
<h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
</h2>
</div>
<b:include data='post' name='post'/>
<b:if cond='data:post.includeAd'>
<b:if cond='data:post.isFirstPost'>
<data:defaultAdEnd/>
<b:else/>
<data:adEnd/>
</b:if>
<div class='inline-ad'>
<data:adCode/>
</div>
<data:adStart/>
</b:if>
</b:if>
</b:if>
</b:loop>
</b:if>
</b:if>
<b:if cond='data:blog.pageType == "static_page"'>
<div class='post'><h3><data:post.title/></h3></div>
<div class='post'><data:post.body/></div>
<b:include data='post' name='postQuickEdit'/>
<b:include data='post' name='shareButtons'/>
</b:if>
<b:if cond='data:blog.url != data:blog.homepageUrl'>
<b:if cond='data:blog.pageType != "static_page"'>
<script type='text/javascript'>var ssyby='<data:post.dateHeader/>';</script>
<h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comments'/>
</b:if>
</b:if>
</b:if>
</b:loop>
<data:adEnd/>
</div>
In above code localize the row:
<b:if cond='data:label.name != "computer"'>
In my case the label I want to exclude from homepage is "computer" (red highlighted). You change it with what you want.
With this technique you'll have the date header on each post, also in post published on the same day.
Important: for a correct blog visualization this technique the user needs enabled javascript. Notice: give always a label to every post, otherwise this trick doesn't work properly.
Open your template.
Locate:
<b:if cond="data:mobile == "false"">
<!-- posts -->
Just below replace this code (there may be small differences in your template but the block is this):
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<data:defaultAdStart/>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.isDateStart'>
<b:if cond='data:post.isFirstPost == "false"'>
</div></div>
</b:if>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-outer">
</b:if>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'><span><data:post.dateHeader/></span></h2>
</b:if>
<b:if cond='data:post.isDateStart'>
<div class="date-posts">
</b:if>
<div class='post-outer'>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "static_page"'>
<b:include data='post' name='comment_picker'/>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comment_picker'/>
</b:if>
</div>
<b:if cond='data:post.includeAd'>
<b:if cond='data:post.isFirstPost'>
<data:defaultAdEnd/>
<b:else/>
<data:adEnd/>
</b:if>
<div class='inline-ad'>
<data:adCode/>
</div>
<data:adStart/>
</b:if>
</b:loop>
<b:if cond='data:numPosts != 0'>
</div></div>
</b:if>
<data:adEnd/>
</div>
with:
<b:if cond='data:mobile == "false"'>
<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<data:defaultAdStart/>
<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast == "true"'>
<b:if cond='data:label.name != "computer"'>
<div class='date-header'>
<h2 class='date-header'>
<script type='text/javascript'>var ssyby='<data:post.dateHeader/>';</script>
<h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
</h2>
</div>
<b:include data='post' name='post'/>
<b:if cond='data:post.includeAd'>
<b:if cond='data:post.isFirstPost'>
<data:defaultAdEnd/>
<b:else/>
<data:adEnd/>
</b:if>
<div class='inline-ad'>
<data:adCode/>
</div>
<data:adStart/>
</b:if>
</b:if>
</b:if>
</b:loop>
</b:if>
</b:if>
<b:if cond='data:blog.pageType == "static_page"'>
<div class='post'><h3><data:post.title/></h3></div>
<div class='post'><data:post.body/></div>
<b:include data='post' name='postQuickEdit'/>
<b:include data='post' name='shareButtons'/>
</b:if>
<b:if cond='data:blog.url != data:blog.homepageUrl'>
<b:if cond='data:blog.pageType != "static_page"'>
<script type='text/javascript'>var ssyby='<data:post.dateHeader/>';</script>
<h2 class='date-header'><span><script type='text/javascript'>document.write(ssyby);</script></span></h2>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comments'/>
</b:if>
</b:if>
</b:if>
</b:loop>
<data:adEnd/>
</div>
In above code localize the row:
<b:if cond='data:label.name != "computer"'>
In my case the label I want to exclude from homepage is "computer" (red highlighted). You change it with what you want.
With this technique you'll have the date header on each post, also in post published on the same day.
Important: for a correct blog visualization this technique the user needs enabled javascript. Notice: give always a label to every post, otherwise this trick doesn't work properly.
No comments:
Post a Comment