Announcement

Collapse
No announcement yet.

Excluding part of full description in search index

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Excluding part of full description in search index

    Morning all,

    In our product full descriptions on each page we have some html for the 'customers who bought this also bought...' stuff, e.g.

    http://www.dots4strings.com/acatalog/Anitras_Dance.html

    Unfortunately Actinic is indexing all this and bringing it back in the search results, so when you search for a title you also get back all the related titles as well (a bit confusing). We're trying to think of a way of splitting up the title in the html bit of the full description so it won't index it. Maybe just split off the front letter using an underline - what about this:

    <li><a href="http://www.dots4strings.com/acatalog/humoreske.html"
    title="Humoreske"><u>H</u>umoreske</a></li>

    You can see that the word 'Humoreske' in the a ref is now '<u>H</u>umoreske' which displays the same, is still a hyperlink, but Actinic will only index the 'umoreske' part and not the whole word. This stops Anitra's Dance being returned in the search results if they type in Humoreske.

    Can anyone think of a better way of doing this? Is there any code you can put into the full description to say 'do not index this bit'?

    Many thanks,
    Des
    Des Crocker

    http://www.dots4strings.com - modern & classical string quartet arrangements

    #2
    Since you want a list of links the following should automate it as well as hide the names.
    You only need to change a simple list of links and names per product. All HTML is generated.

    Put the following just above the </HEAD> line in Act_Primary.html
    Code:
    <script type="text/javascript">
    <!--
    function showrelated(related){
     for ( i=0; i < related.length; i += 2 )
      {
      document.write('<br><a href="http://www.dots4strings.com/acatalog/' + related[i] + '">' + related[i+1] + '</a>');
      }
    }
    // -->
    </script>
    And put this in the Product Description
    Code:
    !!<<script type="text/javascript">
    <!--
    showrelated([
    	'humoreske.html','Humoreske',
    	'middle.html','Middle',
    	'last.html','Last'
    	]);
    // -->
    </script>>!!
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Many thanks Norman - a great little bit of code.

      Works a treat

      Cheers,
      Des
      Des Crocker

      http://www.dots4strings.com - modern & classical string quartet arrangements

      Comment


        #4
        I ran into a problem last night while implementing the code more fully. The product description box kept emptying when I clicked Apply on a seemingly random basis when entering the javascript code.

        Example of a Product Description:

        Originally a piece for violin and piano, written as a follow-up to Chanson de Nuit.

        !!<<hr class="productdetail" />
        <b>Customers who bought this title also bought:</b>
        <ul>
        <script type="text/javascript">
        <!--
        showrelated([
        'Morning.html','Morning (Peer Gynt Suite)',
        'Meditation.html',Meditation from Thais',
        'Melodie.html','Melodie (Tchaikovsky)'
        ]);
        // -->
        </script>
        </ul>
        >!!


        After much mucking around I have fixed it by wrapping the javascript function in html tags on its own (probably what you intended me to do anyway Norman ), and the html code above it in tags on its own. I also substitute unicode for any apostrophes in the related title. This seems to work okay! So I end up with this:

        Originally a piece for violin and piano, written as a follow-up to Chanson de Nuit.

        !!<<hr class="productdetail" />
        <b>Customers who bought this title also bought:</b>>!!

        !!<<script type="text/javascript">
        <!--
        showrelated([
        'Morning.html','Morning (Peer Gynt Suite)',
        'Meditation.html',Meditation from Thais',
        'Melodie.html','Melodie (Tchaikovsky)'
        ]);
        // -->
        </script>>!!


        So is it better to always wrap any javascript calls in their own set of html tags, even if there is other html in the same description box?

        Cheers,
        Des
        Des Crocker

        http://www.dots4strings.com - modern & classical string quartet arrangements

        Comment


          #5
          Des,

          Did you put the opening and closing html markers in place first and then type in between them, or was the closing marker not there when you had the problem?
          Bill
          www.egyptianwonders.co.uk
          Text directoryWorldwide Actinic(TM) shops
          BC Ness Solutions Support services, custom software
          Registered Microsoft™ Partner (ISV)
          VoIP UK: 0131 208 0605
          Located: Alexandria, EGYPT

          Comment


            #6
            More likely because your first example is setting up an UL list.

            Unless you added <li>....</li> tags to the showrelated function (<li> instead of the <br> and </li> at the end of the line), you wouldn't be generating valid HTML.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              If you have any problems with JavaScript, the view the page in Firefox and us its Tools / JavaScript console for decent error messages.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Ahah! Missing quote in

                'Meditation.html',Meditation from Thais',

                Firefox would have told you that.

                Also use double quotes instead of single in this patch. Then you won't have to worry about single quotes in the link text.

                "Meditation.html","Meditation from O'Reilly",
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Thanks chaps - more great advice. I do like forums

                  Bill - there were definitely opening and closing html quotes, and Norman yes I did change the function to use <li> and </li> tags so the html should have been good.

                  All I can say now is that it works when I have the javascript wrapped in its own set of html tags - so that's good enough for me. Not sure it should _have_ to be like that though.

                  Thx for the tip about using double quotes which saves having to use unicode for the apostrophes and YES I will use Firefox more often. I prefer it, but when your site is optimised for the 85% of IE users out there I tend to stick in IE so I know what they're going to see.

                  Cheers,
                  Des
                  Des Crocker

                  http://www.dots4strings.com - modern & classical string quartet arrangements

                  Comment


                    #10
                    I too use IE to see what pages will look like.

                    It's when they're misbehaving that Firfox and Opera, both of which have excellent error consoles prove invaluable.

                    PS you wouldn't have needed unicode. Just use a backslash ( O\'Brien or 6\" nails depending on whether the strings are single or double quoted).
                    Norman - www.drillpine.biz
                    Edinburgh, U K / Bitez, Turkey

                    Comment

                    Working...
                    X