Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-11-15 17:45:05

johan_vm
Member
From: Antwerp, Belgium
Registered: 2005-04-24
Posts: 30
Website

How do I use excerpts?

What’s the best ways to use excerpts?

At the moment this is my workflow (when I publish an article on “OnRails.be“http://www.onrails.be”) :

  1. I use two sections: ‘news’, for short stories, and ‘articles’ for long stories.
  2. When I post an article to the ‘articles’ section, I also want an excerpt to appear on the frontpage (= ‘news’ section).
  3. So, I do this by writing the full article in the ‘article’ section, copying a part of the intro – to use as an excerpt – and publish this part as an article in the ‘news’ section (with the same name as the full article).
  4. The excerpt article in the ‘news’ section doesn’t link to the full article in the ‘articles’ section, so I have to link to it hardcoded:

= "// lees verder":http://www.onrails.be/Artikelen/ruby-on-rails-migrations

I understand that this workflow isn’t correct.
What would be a correct workflow?

I want:

  • every article in the ‘articles’ section to have an excerpt that shows up on the front page (‘news’ section).
  • I would like them to be created automatically, without me copying a part to the ‘excerpt’ inputfield.

How do I achieve this?
What can Textpattern do out of the box, and which plugins do you advice?

regards,

Johan.

Last edited by johan_vm (2006-11-15 17:46:24)


Dutch Ruby on Rails news and articles: OnRails

Offline

#2 2006-11-15 20:44:57

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I use excerpts?

Hi Johan,

Textpattern doesn’t create the excerpts for you. So you can either copy the first paragraph or so from the body to the excerpt field, or use a plugin.

Then you set both section ‘news’ and ‘articles’ to be displayed on the front page. Your <txp:article /> tag will automatically show articles on the front page that are set to be displayed there.
You’ll also have to add something to your article form to tell Textpattern to display the excerpt, if any. Replace <txp:body /> with something like this:

<txp:if_article_list>
<txp:if_excerpt>
<txp:excerpt />
<txp:else />
<txp:body />
</txp:if_excerpt>
<txp:else />
<txp:body />
</txp:if_article_list>

You can then replace your handcoded permalink with <txp:permlink>Lees verder</txp:permlink>.

The default sorting order is by date posted, so this will not keep the ‘news’ articles and the ‘articles’ articles separated. If you want to display let’s say first the ‘news’ articles and then the ‘articles’ articles, you can use sort="Section desc, Posted desc" in your article tag.

That should about do it I think :)

Offline

#3 2006-11-15 21:52:29

johan_vm
Member
From: Antwerp, Belgium
Registered: 2005-04-24
Posts: 30
Website

Re: How do I use excerpts?

Hi Els,

Thank you for helping me out.
Your explanation made it super-clear to me.

Textpattern is an incredibly beatifull and powerfull piece of software.
You just need to know where to find everything :-)
I guess it just takes time to get to know al these little tricks,
and thinking you can make a perfect site the first time around is a bit utopian.

The code you gave me is just what I was looking for; and the default sorting order is fine.

This will make my TXP a lot cleaner: no more double posting ‘articles’ articles,…

regards,

Johan.


Dutch Ruby on Rails news and articles: OnRails

Offline

Board footer

Powered by FluxBB