Help with PicoSearch

Can I split pages at anchor tags and jump to anchor sections?

Yes! If you find yourself with a long web page that has separate sections, and you wish PicoSearch could search and return these sections separately, then yes there is a way using anchor tags. In general of course, it is best to design web pages that are short and focussed on one topic at a time, both for the sake of your readers and for search engines which usually return search results just starting from the top of a page URL. But PicoSearch can accomodate long pages such as lists of many products, FAQs, or dated entries. Each unit of information will be separately searchable, and clicking on the search results will jump to the start of that section.


Anchors and fragment identifiers

Browsers can jump into an HTML page at the point of an anchor tag "name" attribute. (The 4.0 standard can even jump to any "id" attribute, but PicoSearch uses just the anchor name at this time). The anchor tag is commonly used with the "href" attribute for making links that point out of a page, but the name attribute creates a target destination within the page. For example, here's an anchor name that begins a section of a larger document called BigPage.html

<a name="Part Two">Part Two Begins Here</a>

This anchor name creates what is called a fragment identifier. The full URL can then include the fragment identifier after a # sign, causing the browser to load the full page and then jump down to that section. Notice that %20 is the safe character encoding for a space in URLs, although most browsers take the space just as well too.

http://www.mysite.com/BigPage.html#Part%20Two

The # in a URL is reserved for fragment identifiers, so it can come after cgi arguments, and for any file extension that is really HTML. PicoSearch doesn't mind how your HTML files are generated either, and all the arguments will be maintained (unless you deliberately chop some out, see the URL Adjustments section of your account manager). So your fragment identifying URL could just as well come from a script or ASP, and could look like this:

http://www.mysite.com/pages.asp?page=BigPage&time=now#Part%20Two


PicoSearch's Anchor Splitting

PicoSearch can split long pages into multiple separate sub-pages, each linked by the proper fragment identifier. This will increase your search engine's total page count, but it's worth it to produce more accurate focussed results that jump directly to the section found by the search. Of course you wouldn't want PicoSearch splitting your HTML pages at every anchor name in your website, so you just have to tell PicoSearch which anchors you want to split.

To mark which anchor names should start a new page in PicoSearch, just add the following PicoSearch attribute/value pair to your anchor name tag. This should be quite harmless, since HTML allows unknown elements to be skipped. This special element can come anywhere in the tag, it's not order dependent. If there's an href too, that link won't be lost and will go into the new page.

<a picosearch="anchor_split" name="Part Two">Part Two Begins Here</a>

If there is some searchable page text up to the point of the first anchor_split, that will be stored as the bare URL, such as BigPage.html. Then the new page will be stored as BigPage.html#Part-Two, and this page will continue either to the end of the page, or to the next anchor_split. Or if you want to stop an anchored sub-page even earlier, you can put picosearch="anchor_end" into any anchor tag further down. In the following example, BigPage.html#Part-Two will not include "another page link" or the disclaimers.

<a picosearch="anchor_split" name="Part Two">Part Two Begins Here</a>
Information about Part Two
<a picosearch="anchor_end" href=link.html>another page link</a>
disclaimers

If you want to only search the anchor sections, and skip the page text that came before the first anchor_split, you can use the attribute picosearch="anchor_only". This logically only affects the first anchor, after that it is equivalent to anchor_split. In the example, PicoSearch would then discard BigPage.html and only store BigPage.html#Part-Two

<a picosearch="anchor_only" name="Part Two">Part Two Begins Here</a>


Titles and Metas of Split Pages

The title, meta description, and meta keywords of anchor split sub-pages will inherit the title and metas of the top parent page. If you want more specific titles and metas within each anchor section, you can always override using the special PICOTITLE, PICOMETADESC and PICOMETAKEYWORD comments that are described in this FAQ on displaying parts of a page in the search results. For example:

<a picosearch="anchor_split" name="Part Two">Part Two Begins Here</a>
<!-- PICOTITLE="Big Page Part Two" -->
Information about Part Two

Here the linked title, which is seen in the search results whenever part two is found, would now say "Big Page Part Two". This title still links to BigPage.html#Part-Two, but otherwise it would have said the same title as BigPage.html, which is probably just "Big Page".

In addition to the title and meta overrides possible within each anchor section, you can also change the default behavior of the title inheriting from the top of the parent page. Putting the following PicoSearch comment tag in the top page section (before the first anchor split) will cause the anchor sections to have titles built from their anchors, title plus anchor, or anchor plus title. For the combined plus cases, the default connecting text is " - ", but that can also be changed with the "spacer" attribute as seen in the last example.

In BigPage.html:

<!-- PICOSEARCH_ANCHOR_TITLES default="anchor" -->
This would cause the anchor split for Part Two in the example above to be titled in the search results as "Part Two", rather than the default of "Big Page".

<!-- PICOSEARCH_ANCHOR_TITLES default="title_anchor" -->
This would cause the anchor split for Part Two in the example above to be titled in the search results as "Big Page - Part Two".

<!-- PICOSEARCH_ANCHOR_TITLES default="anchor_title" spacer=" of " -->
This would cause the anchor split for Part Two in the example above to be titled in the search results as "Part Two of Big Page".

By setting the default this way, and making your anchors nicely readable, you can generate unique titles for each anchored section without having to use a lot of PICOTITLE override tags. Titles are most important since that is what will be linked and most prominently visible on the search results page.


A Working Example

Lastly, here is a working example of a simple Free search account that searches the anchored sections of BigPage.html. Remember that Free accounts may show Sponsor Ads in highlighted boxes, while Paid Accounts have full design control with no required ads and many more features.

PicoSearch
  Help
Site Search by PicoSearch

Anchored URLs are compatible with other features of PicoSearch too. So as you build up many anchor split pages of products or information, you can also do more to control their search results by prioritizing them with Promotions, grouping them with Partitions, skipping some with Exclusions, and even jumping directly to anchor split pages for certain keywords by using Direct Searches



Back to FAQs