Nerdmind/Blog

How do I display just an excerpt of a post in the post feed?

Closed this issue · 5 comments

How do I display just an excerpt of a post in the post feed? As shown in the example in your home blog (where you have the [...] at the end of each post list item) and then when I click to view the post I should see the full version of the post by itself. ATM I have the full post (quite long content) in the actual post feed page. Thanks.

Hi. You can use the excerpt function in your html/feed/item_p{ost|age}.php:

<content:encoded>
	<![CDATA[
		<?=excerpt($HTML, 400)?>
	]]>
</content:encoded>

Hi, Thanks for heading me in the right direction. That above example didnt work however when I used the function in the html/post/item.php file it worked. Thanks again.

<blockquote cite="<?=$POST['URL']?>">
  <?=excerpt($POST['BODY']['HTML'](), 400)?>
</blockquote>

This works, 100 percent:

excerpt($POST['BODY']['HTML'](), 400)

I used $HTML instead of $POST['BODY']['HTML']() in the first example because $HTML already contains the value of $POST['BODY']['HTML']() in the html/feed/item_p{ost|age}.php. The $HTML variable is a "local" variable in this template file.

$HTML = $POST['BODY']['HTML']();

<description><?=escapeHTML(description($HTML, 400))?></description>

Hi. I am not sure if your problem is solved or not.

Hi. I'm just browsing through the old closed issues and just realized that you meant with "post feed" the list of posts on the start page and the post overview and not the RSS feed. That was a bit of a misunderstanding by me. Sorry for confusing you, hehe. 🤦