Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-12-11 14:38:54

woof
Member
Registered: 2004-08-01
Posts: 128

[textile] Exclude content between txp:hide tags from search results?

I’m using txp:hide tags in the body and excerpt field of articles to include notes and to “comment out” sections of text, but I’ve found that the hidden text remains discoverable via the search function and is output by the txp:search_result_excerpt tag

Is there a way to hide such content from search? Or if not, to prevent it from being output by txp:search_result_excerpt?

Offline

#2 2012-12-11 16:47:51

etc
Developer
Registered: 2010-11-11
Posts: 5,178
Website GitHub

Re: [textile] Exclude content between txp:hide tags from search results?

woof wrote:

Is there a way to hide such content from search? Or if not, to prevent it from being output by txp:search_result_excerpt?

  1. Not really. TXP search looks for its text inside not textiled and not parsed body, so everything therein is searchable. The “easiest” solution I can see is to replace <txp:hide /> by Textile ###. comments, and the default <txp:search_input /> with <txp:etc_search query="{Title,Body_html}" />. This will search in textiled body, with comments stripped out, but has some drawbacks.
  2. Yes, if you replace <txp:hide /> by Textile ###. comments.

I may overlook something, though.

Edit: it was etc_search, of course, not etc_query.

Last edited by etc (2012-12-11 20:58:00)

Offline

#3 2012-12-11 17:35:27

woof
Member
Registered: 2004-08-01
Posts: 128

Re: [textile] Exclude content between txp:hide tags from search results?

Thank you Oleg

Offline

#4 2012-12-11 19:29:03

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

Re: [textile] Exclude content between txp:hide tags from search results?

etc wrote:

Textile ###. comments.

And I thought I knew everything about Textile… Thanks, Oleg, never heard of this one before :)

Offline

#5 2012-12-11 21:08:27

etc
Developer
Registered: 2010-11-11
Posts: 5,178
Website GitHub

Re: [textile] Exclude content between txp:hide tags from search results?

Els wrote:

never heard of this one before :)

My knowledge is only 3 hours older than yours. It even works on this forum, see the comment below :)

Offline

#6 2012-12-11 22:48:42

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

Re: [textile] Exclude content between txp:hide tags from search results?

etc wrote:

see the comment below :)

:)

Offline

#7 2012-12-11 23:26:20

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [textile] Exclude content between txp:hide tags from search results?

From now on all of my forum posts will have hidden content.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#8 2012-12-12 01:46:35

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] Exclude content between txp:hide tags from search results?

MattD wrote:

From now on all of my forum posts will have hidden content.

No, mister Frodo.

Offline

#9 2012-12-12 19:41:14

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

Re: [textile] Exclude content between txp:hide tags from search results?

Offline

#10 2012-12-12 20:14:24

woof
Member
Registered: 2004-08-01
Posts: 128

Re: [textile] Exclude content between txp:hide tags from search results?

Haha. Heads up: commented out text shows in the clear in the forum’s “reply to topic” notification email. ;-)

Offline

Board footer

Powered by FluxBB