Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-15 13:54:08

debegray
Member
Registered: 2009-02-04
Posts: 30

Persistent front page

Hi all,

I would like to have a persistent intro on my front page that never gets moved down when new content comes on. Is there a way to do this?

TIA

Offline

#2 2009-02-15 14:15:46

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: Persistent front page

Is there a way to do this?

Yes.

There is.


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#3 2009-02-15 14:16:23

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Persistent front page

Use sticky articles. For example:

<txp:article limit="1" status="sticky" />

Then, set the article to status “sticky” in the Write panel.

Offline

#4 2009-02-15 14:46:37

debegray
Member
Registered: 2009-02-04
Posts: 30

Re: Persistent front page

Thanks – it worked!

Offline

#5 2009-02-15 16:48:39

debegray
Member
Registered: 2009-02-04
Posts: 30

Re: Persistent front page

Oops, it didn’t. If I use the sticky option, other articles don’t show up when I click on them. I looked at the process for creating a static page, and apparently you’re supposed to set it to not appear on the front page. Am I missing something? Is that just because the example is for an About page?

Offline

#6 2009-02-15 17:17:42

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

Re: Persistent front page

I usually create a section ‘intro’ or ‘frontpage’, set it not to appear on the frontpage, write the intro article in it, make it sticky, and use this code on the page:

<txp:if_section name="">
<txp:article_custom section="intro" limit="1" status="sticky" form="yourform" />
</txp:if_section>

or

<txp:if_section name="">
<txp:article_custom id="123" status="sticky" form="yourform" /><!-- id '123' is your intro article -->
</txp:if_section>

After this code you can place your article tag(s) to display your other content.
This way the chance that the intro article will show up somewhere where it is not wanted is as good as zero.

Last edited by els (2009-02-15 20:11:24)

Offline

#7 2009-02-15 18:07:29

debegray
Member
Registered: 2009-02-04
Posts: 30

Re: Persistent front page

That sounds like what I’m trying to do. I followed your instructions and can’t get it to show up on the front page. After I write the article, do I change the section back so that it does appear on the frontpage?

Offline

#8 2009-02-15 18:21:15

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Persistent front page

I think you are missing another article tag. Try this:

<txp:article limit="1" status="sticky" /> (show the sticky article first)
<txp:article limit="10" /> (then show the other articles)

Is this what you are looking for? If not, can you post your page template contents and tell us what it does not do for you…

Offline

#9 2009-02-15 18:31:13

debegray
Member
Registered: 2009-02-04
Posts: 30

Re: Persistent front page

Jstubbs, that worked! Els, I appreciate your idea. I think I’ll keep playing with it.

I really appreciate everyone’s help so much.

Offline

#10 2009-02-15 18:57:04

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Persistent front page

I normally use a slightly different method from Els – I create a section called “Home” and set it to display on the front page.

Then, I just create one article for the front page (Home section). Works fine for static sites. Of course, you could just adapt it slightly if you have more than one article, using the code I posted above.

I’ll write a TXP Tip on this by next weekend…

Offline

#11 2009-02-15 19:00:33

debegray
Member
Registered: 2009-02-04
Posts: 30

Re: Persistent front page

Something a little weird. Now, if you go to a specific article, it shows up twice on the page.

Offline

#12 2009-02-15 19:41:37

debegray
Member
Registered: 2009-02-04
Posts: 30

Re: Persistent front page

I solved the duplicate problem by removing
<div class=“hfeed”> <txp:article limit=“5” /> </div>

Offline

Board footer

Powered by FluxBB