Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-30 09:47:16

Bender
Member
From: Czech Republic
Registered: 2005-11-01
Posts: 23
Website

Search in static pages

Hi,

I have one question.

On my site I use static pages (http://textpattern.com/faq/31/how-do-i-manage-static-pages) – sticky articles.

I can not search in this pages. Why? Can I fix it?

Thank to all

Offline

#2 2006-01-30 10:40:53

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Search in static pages

It’s because they are “sticky” articles. Provided you are using TXP 4.0.3, and provided you do not use a <code><txp:article_custom /></code> tag which isn’t searchable anyway, try adding “searchsticky=1” to your tag like so – <code><txp:article searchsticky=1 /></code>.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2006-01-30 12:22:55

Bender
Member
From: Czech Republic
Registered: 2005-11-01
Posts: 23
Website

Re: Search in static pages

Thank you! Now is search ok.

I have sticky article for example like this: www.example.com/contact/ – static content

And when I search “contact” I have this result url: www.example.com/contact/contact (name of article)

Is there any way to change it in search result?

In my sitemap (txp generated) is wrong URL too.

Thank you very much

Offline

#4 2006-03-02 14:12:51

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,771
Website

Re: Search in static pages

bender, it sounds like you have a section called contact with an article called contact in it (and section/title urls ste in the admin panel). Then it appears that way and the search result is correct.

If you have no other articles in that section then entering www.example.com/contact will list the only article it can find.

If, for instance, you had several contact articles, such as “contact abc office” and “contact xyz office” and maybe “reaching us in an emergency” then usually the most-recent contact-article will display first (depending upon the sortby value of your txp_article tag).


TXP Builders – finely-crafted code, design and txp

Offline

#5 2006-03-02 17:52:04

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Search in static pages

The search result is correct, but it’s still not the desired effect. :)

What you can do is make use of if_article_section in your search_results form, i.e:

<txp:if_article_section name="contact">

<h3><a href="<txp:site_url /><txp:section />"><txp:title /></a></h3>

<p><txp:search_result_excerpt /><br/>

<small><a href="<txp:site_url /><txp:section />"><txp:site_url /><txp:section /></a> &middot;

<txp:posted /></small></p>

<txp:else />

<h3><txp:permlink><txp:title /></txp:permlink></h3>

<p><txp:search_result_excerpt /><br/>

<small><txp:permlink><txp:permlink /></txp:permlink> &middot;

<txp:posted /></small></p>

</txp:if_article_section>

Offline

#6 2006-03-07 19:49:40

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: Search in static pages

Mary’s suggestion works great if you only have one section with this kind of one-article “static page” setup. Unfortunately, the Txp site I just completed (my first!) uses that method for every section (except for the search-blocked sidebar section).

<txp:if_article_section> doesn’t take comma-seperated values for the name attribute, and I didn’t want to hugeify my search result form with multiple conditions. Since I’m hosted on an Apache web server, I used redirects in .htaccess instead:

<pre><code>Redirect permanent /about/about http://www.tucsonhospitalityinn.org/about/</code></pre>

It’s tidy, and it works without putting any additional overhead on Textpattern. The search results will still give the repetative URL, but both humans and search engines will end up in the right place. Of course, for those without Apache (or without permission to edit .htaccess), Mary’s solution works great as well.

Offline

#7 2006-03-09 15:19:19

Bender
Member
From: Czech Republic
Registered: 2005-11-01
Posts: 23
Website

Re: Search in static pages

Thank!!

Offline

Board footer

Powered by FluxBB