Silly Sitemap Question
Silly Sitemap Question
Maybe this is a silly question, but, could anyone explain why the Sitemap generator would create a sitemap that includes hidden products and categories?
I'm assuming that there is no way around this problem, other than to create a sitemap some other way...?
Thanks for the help.
Scott
I'm assuming that there is no way around this problem, other than to create a sitemap some other way...?
Thanks for the help.
Scott
- Shopping Cart Admin
- AbleCommerce Admin
- Posts: 3055
- Joined: Mon Dec 01, 2003 8:41 pm
- Location: Vancouver, WA
- Contact:
Re: Silly Sitemap Question
Hello Scott,
Guess not to many folks are using hidden products and feeds, we've confirmed this in the final build and will get it reported as a bug.
Guess not to many folks are using hidden products and feeds, we've confirmed this in the final build and will get it reported as a bug.
Re: Silly Sitemap Question
Hi,
Has there been any fix provided for this issue?
IF not, could I manually go into my sitemap and just delete the lines with hidden products and categories? is there any checksum or something that would invalidate the file?
Thanks
Brian
Has there been any fix provided for this issue?
IF not, could I manually go into my sitemap and just delete the lines with hidden products and categories? is there any checksum or something that would invalidate the file?
Thanks
Brian
Re: Silly Sitemap Question
I dont know about the automatic generator. But you can edit the map by hand with out hurting anything.
Re: Silly Sitemap Question
You can try the following quick fix if you want to exclude the hidden categories, products and webpages from the site map.
Edit the App_Code/CommonSiteMapProvider.cs and locate the following line of code
and make it look like
Locate the following line of code
and make it look like
Locate the following line of code
and make it look like
Edit the App_Code/CommonSiteMapProvider.cs and locate the following line of code
Code: Select all
if (cat.Visibility != CatalogVisibility.Private)
Code: Select all
if (cat.Visibility != CatalogVisibility.Private && cat.Visibility != CatalogVisibility.Hidden)
Code: Select all
if (prod.Visibility != CatalogVisibility.Private)
Code: Select all
if (prod.Visibility != CatalogVisibility.Private && prod.Visibility != CatalogVisibility.Hidden)
Code: Select all
if (wp.Visibility != CatalogVisibility.Private)
Code: Select all
if (wp.Visibility != CatalogVisibility.Private && wp.Visibility != CatalogVisibility.Hidden)
Re: Silly Sitemap Question
This worked great!
One more thing... the sitemap here just captures the ablecommerce store. Is there any code i can add that will bring in the other sites I have? Able is my store, but i have lots of other static pages for educational purposes.
Thanks,
Brian
One more thing... the sitemap here just captures the ablecommerce store. Is there any code i can add that will bring in the other sites I have? Able is my store, but i have lots of other static pages for educational purposes.
Thanks,
Brian
Re: Silly Sitemap Question
You can accomplish this in two ways.This worked great!
One more thing... the sitemap here just captures the ablecommerce store. Is there any code i can add that will bring in the other sites I have? Able is my store, but i have lots of other static pages for educational purposes.
Thanks,
Brian
1)- There is a method named PopulateCommonUrls in App_Code/CommonSiteMapProvider.cs file.
Code: Select all
private void PopulateCommonUrls(List<SiteMapUrl> siteMapItems, SiteMapOptions options)
{
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/Default.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/ContactUs.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/AboutUs.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
}
Code: Select all
private void PopulateCommonUrls(List<SiteMapUrl> siteMapItems, SiteMapOptions options)
{
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/Default.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/ContactUs.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/AboutUs.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl("~/custompage.aspx"), options.DefaultChangeFrequency, options.DefaultUrlPriority));
}
Code: Select all
private void PopulateStaticUrls(List<SiteMapUrl> siteMapItems, SiteMapOptions options)
{
string url = "~/";
string path = HttpContext.Current.Server.MapPath(url);
String[] files = Directory.GetFiles(path,"*.aspx",SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
FileInfo fileInfo = new FileInfo(file);
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl(GetAbsoluteUrl("~/"+fileInfo.Name)), options.DefaultChangeFrequency, options.DefaultUrlPriority));
}
}
Code: Select all
PopulateCommonUrls(siteMapItems, options);
Code: Select all
//PopulateCommonUrls(siteMapItems, options);
PopulateStaticUrls(siteMapItems, options);
One more thing as adding all the root pages to the site map would not be a desired operation. So it would be better that you use some slandered name prefix for the custom pages. For example "Custom_MyPage.aspx". This means that all your custom pages names are prefixed now so you can update your custom function to generates the links for those pages as below
Code: Select all
private void PopulateStaticUrls(List<SiteMapUrl> siteMapItems, SiteMapOptions options)
{
string url = "~/";
string path = HttpContext.Current.Server.MapPath(url);
String[] files = Directory.GetFiles(path, "Custom_*.aspx", SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
FileInfo fileInfo = new FileInfo(file);
siteMapItems.Add(new SiteMapUrl(GetAbsoluteUrl(GetAbsoluteUrl("~/"+fileInfo.Name)), options.DefaultChangeFrequency, options.DefaultUrlPriority));
}
}
Code: Select all
PopulateCommonUrls(siteMapItems, options);
Code: Select all
PopulateCommonUrls(siteMapItems, options);
PopulateStaticUrls(siteMapItems, options);