Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-25 07:26:04

BrotherKane
New Member
From: Toronto, Canada
Registered: 2007-03-06
Posts: 5

txp:excerpt question

In the context of an article list page, I’d like to display the excerpt of each article, with a CSS formatted ‘read more’ link following immediately after the excerpt (on the same line). The problem I’m running into is that TXP wraps the excerpt in <p> tags and my link appears several lines below the excerpt. I’d like my custom link to appear inside the same paragraph as the excerpt, so I’m curious if there’s anyway to exclude the <p> tags from the article excerpt so I can format it manually, or maybe there’s a CSS solution to make my ‘read more’ link appear in line with the excerpt.

Any help would be appreciated. Thanks!

Last edited by BrotherKane (2008-01-25 07:26:30)

Offline

#2 2008-01-25 08:09:10

simsim
Member
Registered: 2006-05-06
Posts: 70

Re: txp:excerpt question

In the article Write tab:

Advanced Options -> Excerpt Markup: Leave text untouched

The default uses Textile formatting, which wraps <p> & </p> around excerpt text.

Offline

#3 2008-01-25 15:31:03

BrotherKane
New Member
From: Toronto, Canada
Registered: 2007-03-06
Posts: 5

Re: txp:excerpt question

Perfect. This is just what I need. Is there a way to set this by default so I don’t have to select it manually on every new article?

Offline

#4 2008-01-25 15:40:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: txp:excerpt question

You can also start your ‘paragraphs’ with a space which disables textile.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2008-01-25 16:06:54

BrotherKane
New Member
From: Toronto, Canada
Registered: 2007-03-06
Posts: 5

Re: txp:excerpt question

That’s a helpful tip, too. I’d prefer to have a solution that doesn’t require an action being performed on every new article, which would be easy to forget with multiple authors working on the blog, and could throw off the styling of the article list page very easily. I’d like the functionality to be built into the site with no extra work needed.

The best solution seems to be to disable textile formatting on article excerpts by default, but I’m assuming I’ll have to edit one of the .php files to make that happen.

Offline

#6 2008-01-25 16:12:03

BrotherKane
New Member
From: Toronto, Canada
Registered: 2007-03-06
Posts: 5

Re: txp:excerpt question

Nevermind. This plugin seems to do what I’m looking for:

upm_textile_toggle

Thanks to you both for your help.

Last edited by BrotherKane (2008-01-25 16:12:23)

Offline

#7 2009-04-02 01:47:23

minusf
Member
Registered: 2005-02-15
Posts: 104

Re: txp:excerpt question

this question seems to come up every once in a while…
it is almost another faq. i was just biten by it as well..

my issue with this problem is, turning off textile for the excerpt
takes away bold, italics, links, etc. and that is kind of unacceptable.
so Mary’s plugin is not really an option either.

telling my editors “start the excerpt always with a space”
is just asking for trouble and i don’t see why always
the non-technical people should suffer instead of us
the programmers :]

it is trivial to create a new form to slap anything around
<txp:excerpt />, but it is way harder to get rid of the wrapping <p>’s.

is there a technical reason or is it more of a “txp philosophy” reason?


we is experts™

Offline

#8 2009-04-02 18:24:22

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: txp:excerpt question

Download upm_textile, disable Textile for excerpt and then try something like this on your article form:

<txp:upm_textile>p. <txp:excerpt /> <txp:permlink>Read more!</txp:permlink></txp:upm_textile>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#9 2009-04-02 19:05:12

minusf
Member
Registered: 2005-02-15
Posts: 104

Re: txp:excerpt question

another plugin i did not know about :]

interesting. i must say i find it rather roundabout, installing 2 plugins
and modifying forms just to get rid of a wrapping <p>, when
going the other way would be much simpler i think, but we can’t have
everything, can we :]

i have installed both plugins, upm_textile and upm_textile_toggle.
the later is not so important at the moment, because it will apply
only to the posts created after installing it, if i read the docs correctly.

actually your example is precisely what i am trying to avoid: having
the excerpt in a paragraph, and incidentally, this is the default behaviour
without the plugins. so i am not sure why you made it like this, but
it is a good starting point :] i modified my form, changed the said
articles to have “leave text untouched” and resaved it.

and finally i can say, it is working. but one must still leave a space
in front of the excerpt tag, but it is hidden from the editor so i am happy.

so for the archives: install both plugins, and/or resave the older articles
with the changed settings, and change your form to include:

<txp:upm_textile> <txp:excerpt /> <txp:permlink>&raquo;</txp:permlink></txp:upm_textile>

but without that space, the wrapping paragraph will be there again.
thanks for the tip amigo.


we is experts™

Offline

Board footer

Powered by FluxBB