the CanonicalTag needs to be checked against the page URL.
If it's different, don't include it.
If it's the same, it can be included in the list.
I think i'm struggling to understand the use of 'IsVisible' - we have a checkbox on every page called 'Hide Page' (umbracoNaviHide) which I understand it hides from menu, but not sure whether this is hiding pages from the sitemap too.
i can only view Trace Logs (if this is what you mean), however there are no entries for the last 2 hours.
the last entry was:
Application shutdown. Details: HostingEnvironment
_shutDownMessage=HostingEnvironment initiated shutdown
HostingEnvironment caused shutdown
_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
at System.Web.Hosting.HostingEnvironment.InitiateShutdownWithoutDemand()
at System.Web.Hosting.PipelineRuntime.StopProcessing()
Ok thanks. Done that, however I may be missing something?
It doesn't work, which leads me to think that I may not have created the boolean value correctly.
All i did to add the boolean value was edit the composite to feature another field. Should i republish site or carry out any other tasks to complete this or is that all I need to do?
Adding query to sitemap generator file (check for boolean value)
Hi all. Me again!
Wondered if someone could offer me a solution (probably a real easy syntax issue) to this:
I'd like to add a query that checks to see whether a checkbox is ticked on every page. If it is, it needs excluding from the sitemap generator.
My addition is the .where(x =>x.HasProperty(hideFromSitemap) line.
Any help appreciated! (ps. i know my CanonicalTag doesn't follow naming convention properly! )
Hi n00b
I think you need this code:
Also, I'm not sure that you have right brackets, my VS shows that it should be like that:
Hope it will help, thanks/
Alex
I should also add, that my intention was to remove the 'Is.Visible' query to enable all pages to be included unless my hideFromSitemap is checked.
(The underlying issue is that 'IsVisible' not only removes pages from the menu, but means they're excluded from sitemap generation too).
My checkbox was to allow all pages to be included, and go through manually making sure unimportant ones had the box ticked to exclude.
Also, I'm not sure that this line is working, what type of data in "CanonicalTag" property?
Wow! you're fast. Thanks guys.
The CanonicalTag is a text string. What should happen is:
Check if there's a canonical tag If the canonicaltag is different to the page url { exclude this page from sitemap}
The hideFromSitemap is a boolean checkbox What should happen is:
if hideFromSitemap is True { exclude this page from sitemap}
Will try both your suggestions, thanks.
This outputs nothing in the sitemap xml.
the CanonicalTag needs to be checked against the page URL. If it's different, don't include it. If it's the same, it can be included in the list.
I think i'm struggling to understand the use of 'IsVisible' - we have a checkbox on every page called 'Hide Page' (umbracoNaviHide) which I understand it hides from menu, but not sure whether this is hiding pages from the sitemap too.
Try this one:
Thanks Alex, It partially generates the page, but not quite!
and can you check what is the error? maybe in the log?
i can only view Trace Logs (if this is what you mean), however there are no entries for the last 2 hours.
the last entry was:
Application shutdown. Details: HostingEnvironment
What version of your code doesn't throw an error?
You have to add to this code check for your new property:
If 'hideFromSitemap' checked => do not include page in sitemap
Ok thanks. Done that, however I may be missing something? It doesn't work, which leads me to think that I may not have created the boolean value correctly.
All i did to add the boolean value was edit the composite to feature another field. Should i republish site or carry out any other tasks to complete this or is that all I need to do?
(almost) Solved it! name of variable/property hideFromSitemap wasn't correct - fixed. brackets in wrong places - fixed.
now i have another issue whereby it's pulling in pages from the manually created redirect list in web.config! AARRRGGGHHHH
Here's the working code for anyone else facing a similar issue:
Hi
How did you create manually created redirects?
Is it like a list of urls, then you parse this list and if page is in this list - redirect?
Alex
I have no access to the server to do this in IIS, so had to add them to the web.config :
is working on a reply...