Forum

Thread tagged as: Problem, Suggestions, Blog

Republishing blog posts

Is there some way to republish blog posts after updating the post.html template? Like you can for page content regions.

I added a checkbox to an existing clients blog template to allow them to pin featured posts to the top of the blog listings, similar to this: https://forum.grabaperch.com/forum/11-20-2015-blog-featured-pinned-post … only problem is that every post has to be manually resaved for non-pinned posts to be displayed & there are hundreds!

Nothing is output from this, presumably because the newly added field I'm using to filter the result with (featured_post) is missing.

perch_blog_custom([
    'template' => 'post_in_list.html',
    'count' => 8,
    'sort' => 'postDateTime',
    'sort-order' => 'DESC',
    'filter' => 'featured_post', 
    'match' => 'neq', 
    'value' => 1
]); 

Thanks in advance!

Adam Green

Adam Green 0 points

  • 2 years ago

Hi Adam,

If I remember correctly you can visit:

/perch/addons/apps/perch_blog/update/

Thanks Mike, I see that has helped others in the past (where categories are concerned) but unfortunately doesn’t work in this case.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Try removing the row for perch_blog_update in the perch3_settings table and run the update again.

Thanks Drew, I just tried your suggestion but still no success.

I found a workaround to filter out the non-pinned posts by doing the filtering with if statements inside the post_in_list.html template, i.e.

<perch:if id="featured_post" value="1" match="eq"><perch:else>
<li class="hentry"> [ post summary ] </li>
</perch:if>

Is there a republish function earmarked for a future blog app update & if not, would you please consider? Many thanks!

Drew McLellan

Drew McLellan 2638 points
Perch Support

I just tried your suggestion but still no success.

What happened? Did you see the update run through your posts 10 at a time?

Yes, it ran through the update 10 posts at a time as you'd expect, but the new featured_post checkbox field id wasn't added to the (unchecked) posts - verified by adding <perch:showall/> to the post_in_list.html loop. I thought it might be to do with the binary nature of the checkbox field type, so I tried it as a select type instead, removed the perch_blog_update entry form the perch3_settings table in the db & ran the update again, but no difference.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I would've expected that to work, but perhaps not. That's all a republish would do (that's what it's doing) so I'm not sure adding another republish option would help you.