Forum
Blog excerpt - first listing indented
Hi, I am trying to add blog excerpts to the home page, when I do the listings have the first one indented (normal I think?) and any others below not indented and are listed with a bullet point.
I am using a custom formatting function:
perch_blog_custom(array(
'sort'=>'postDateTime',
'sort-order'=>'DESC',
'template'=>'blog/homepage_post_in_list.html',
'count'=>3
A custom template:
<perch:before>
<ul class="hfeed listing"></perch:before>
<li class="hentry">
<h2><a href="<perch:blog id="postURL" />" rel="bookmark" class="entry-title"><perch:blog id="postTitle" /></a></h2>
<p class="entry-published date"><perch:blog id="postDateTime" format="%d %B %Y" /></p>
<div class="description entry-summary">
<perch:blog id="excerpt" type="textarea" editor="redactor" html="true" />
</div>
</li>
<perch:after>
</ul>
</perch:after>
And this is the resulting html code:
<article class="side-bar-blog">
<ul class="hfeed listing">
<li class="hentry">
<h2><a href="/blog/post.php?s=2015-04-14-nine-of-the-best-fat-loss-foods" rel="bookmark" class="entry-title">Nine of the best fat loss foods</a></h2>
<p class="entry-published date">14 April 2015</p>
<div class="description e-content">
<p>So, you want to eat well but lose fat? Well, make sure you’re eating the right foods then!</p>
<p>See a list of what you should be eating on our News section . . <br></p>
</div>
</li>
</article>
<li class="hentry">
<h2><a href="/blog/post.php?s=2015-03-23-cardio-sucks" rel="bookmark" class="entry-title">Cardio Sucks!</a></h2>
<p class="entry-published date">23 March 2015</p>
<div class="description e-content">
<p>To be honest many people hate cardio exercise with a passion, the thought of getting on a treadmill or Stairmaster and huffing away for hours on end is probably less appealing than going five rounds with Mike Tyson in his prime!<br></p>
</div>
</li>
</ul>
</article>
Any idea what I am doing wrong?
Here is the example as a screen shot:
Are you wanting to indent the first post? If so, you aren't specifying a different style for the first item.
You can do this by using
<perch:every>
. For example:You can view more information about
<perch:every>
hereHi, Thanks for your reply.
No I do not want to indent the first post - it is doing it all by itself and I want to stop it happening. (see example posted)
I cannot stop it and I believe it is because the system is not generating a second <article> tag? No idea what I am doing wrong. .
But thanks for the heads up on <perch:every> that may be useful ..
The
<article>
tags are throwing it off.Where are they coming from? I don't see them in your template.
No Idea?!
I will look again in detail. So Perch does not generate them unless they are part of the template?
Perch generates practically nothing unless it's in your template.
Weird.
So I replaced the template I edited with the default
post_in_list.html
and nothing changed? Still the same error on the<article>
tags?Could I have edited another template? Would the custom function grab any other info?
Does
<article>
appear in any of your templates? It has a class:No . . I am only using Perch as a blog engine for a hand coded site at the moment. I have only edited
post.php
to display the blogs in my site format and thepost_in_list.html
as mentioned. All other templates are still system default. The edited templates are withinblog/templates
as suggested.I did create the class and as it is associated with an article so it must be resident in some template somewhere. I will keep looking.
Is there a cache I can clear?
Thanks for your help.
Yes, put your site in development mode, then the cache isn't used:
https://docs.grabaperch.com/docs/installing-perch/configuration/perch/