[pmwiki-users] How to show only the first 100 words of content of a wikipage?

Patrick R. Michaud pmichaud at pobox.com
Sat Jun 9 11:18:40 CDT 2007


On Thu, Jun 07, 2007 at 11:50:13AM -0500, Tegan Dowling wrote:
> On 6/7/07, Eugene Van den Bulke <eugene at boardkulture.com> wrote:
> > Martin Spindler wrote:
> > > for the startpage of my blogsimple2 wiki I would like to show a
> > summary
> > > of every post. How can I show only the first 100 words (or first
> > > paragraph, or ???) of each wikipage?
> 
> > [[#lnews]]
> > !!{=$Name}
> > (:include {=$FullName} self=0 lines=3:)
> >
> > %right% [[{=$FullName} | ... more ...]]
> > [[#lnewsend]]
> 
> The way PmWiki works, three lines = three paragraphs, correct?  And any or
> all of them could be blank rows and/or wikicode rather than text, also
> correct? 

The first three lines of a page is not always three paragraphs, or even
a paragraph.  It's just the first three lines of the page.

> The matter of displaying some portion of the content of a page, where that
> portion is determined more or less automatically, rather than by a pair of
> [[# anchor]] tags, comes up various places, and I haven't seen one final
> set of answers -- I'm thinking about applications such as page-summaries
> for search results, and for RSS feeds, as well as for blog-like excerpts.

There hasn't been a final set of answers because it's a fairly difficult
problem.  I've invited suggestions from time to time, but we've not come to
any good conclusions.

The latest approach I've been looking at is to have [[#teaser]]...[[#teaserend]]
anchors in the page text that delimit excerpts to be displayed.  Then
a {$Teaser} page variable would display the teaser for any given page.

Automatically calculating a teaser from text is a bit of a difficult 
problem, but if we come up with an algorithm for that we could include it
as part of the {$Teaser} variable (to be used when an explicit [[#teaser]]
section isn't identified).

> I think this should all become a page, or at least an FAQ item.
> 
> * (:description ... :) [...]
> * (:Summary: ... :)    [...]
> * Pagelist with teasers --
> http://www.pmwiki.org/wiki/Cookbook/PagelistTemplateSamples#Teasers; uses
> (:include ... lines=x:); each line is a paragraph; will include wikimarkup
> 
> Which, if any, of these generates the <description> content that (I think)
> an RSS display anticipates?

I haven't found an answer that fits all situations.
Some RSS feeds expect <description> to be a description of
the page, while other RSS feeds expect it to be a description
of the changes made to that page.  Sometimes a teaser is
appropriate, other times it should be a page summary, other
times it should be some other sort of description.

If we can come up with a set of PmWiki conventions/standards that
seem to work for lots of people I'll be glad to incorporate it
(as recipe or perhaps core), but so far I haven't seen a
consensus opinion on this.

Pm



More information about the pmwiki-users mailing list