Announcement

Collapse
No announcement yet.

How to Exclude a Product from the Sitemap Feed

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

    How to Exclude a Product from the Sitemap Feed

    We have some products that are only available to certain price groups. When I run the Google Sitemap Feed, though, it adds these products to the sitemap xml file. If someone tries to go to these product pages, they will just get a Not Found Product Not Available error since the products are hidden unless logged into the price group. Right now I'm having to go in by hand and edit the sitemap xml file to remove these products. I know there is a Sitemap Exclude item, but it only works for Pages, not individual products. Is there a way I can mark individual products for exclusion from the Sitemap Feed?

    Thanks!

    #2
    Miva's feed-based sitemap module works great but certain aspects of it are inflexible. I don't think there's necessarily a setting available to accomplish what you're trying to do. I imagine there may be at some point in the future though.

    In the past, we've taken the sitemap module from Miva's limited source kit and customized it for any of our specific needs. In this case, it could be customized to look at a custom product field that identifies products that should be suppressed from the sitemap.

    There may be a more roundabout approach that could get this working for you without the need to spin up your own module, but I can't think of it at the moment.
    Justin Sims
    216digital
    Cleveland Area - Code and Design
    https://216digital.com/

    Comment


      #3
      Old thread but here is an example of how to take out certain products from the feed if you are using a template based feed.

      Code:
      <mvt:if expr="l.settings:record:code EQ 'PRODUCTCODE' OR l.settings:record:code EQ 'PRODUCTCODE'">
      <mvt:else>
      &mvt:record:code;,&mvt:record:name;,&mvt:record:descrip;,&mvt:record:inventory;,&mvt:record:price;,&mvt:record:url;,&mvt:record:customfield:main;&mvt:eol:crlf;
      </mvt:if>
      You can use as many OR l.settings:record:code EQ 'PRODUCTCODE' statments as you need.

      Just make sure there is no record Iterator code between the <mvt: if and <mvt:else> Statements.
      Nick Harkins
      www.loveisarose.com

      Comment


        #4
        Probably a better way would be to use a custom field. Make it a checkbox and call it 'no_map', then use:

        Code:
        <mvt:if expr="NOT(l.settings:record:record:customfield:no-map" />
        Write out site map line
        </mvt:if>
        Be sure to assign that custom field to the site map template (its below the template text area).


        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          Originally posted by Bruce - PhosphorMedia View Post
          Probably a better way would be to use a custom field. Make it a checkbox and call it 'no_map', then use:

          Code:
          <mvt:if expr="NOT(l.settings:record:record:customfield:no-map" />
          Write out site map line
          </mvt:if>
          Be sure to assign that custom field to the site map template (its below the template text area).

          Good call Bruce, way more efficient! Although that code didn't work.

          I did get this to work though.

          Code:
          <mvt:if expr="ISNULL l.settings:record:customfield:no_map">
                  Write out site map line
          </mvt:if>
          Good rule of thumb is to use underscores ( _ ) instead of hyphens (-) for any custom field codes.

          You of course will have to make sure that custom field check box is indeed checked in the admin on the products you want excluded.
          Nick Harkins
          www.loveisarose.com

          Comment


            #6
            yea, never use - in ANY variable. that was just a typo. personally, I tend to use camalCase cause...lazy.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


              #7
              Bruce - PhosphorMedia I figured you knew that. That was more for anyone who stumbled upon the thread.

              Your suggestion of using custom fields helped greatly though.

              I no longer have to add product codes to any of the feed templates (primarily our google shopping and facebook product feeds).

              No more template tweaking!
              Nick Harkins
              www.loveisarose.com

              Comment


                #8
                How can this be accomplished using the "Standard Sitemap Protocol Feed"? We just have some products that are only available as add-ons and don't want them to get indexed but they are showing in the sitemap.xml file. I don't see a place to edit a 'template' for this. We already have a custom field in place to use to exclude them.

                Comment


                  #9
                  There isn't a way to edit the built in xml site map. Best idea i can think of is to create a script that goes through and makes those marked product temporarily inactive. Run the site map. The run a script to set them back to active.

                  (Note: not sure why miva didn't make the template editable. Yes, it would be difficult as its XML, but a good developer wouldn't have much of an issue with that.
                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment


                    #10
                    Thanks for the suggestion. For now, I manually removed the 10 or so products from the generated xml file and will just have to remember to do that everytime. I will just hope that Miva adds the ability to exclude products & categories from it sorta like it does for pages.

                    Comment

                    Working...
                    X