var domainPrefix = string.Format("http://{0}/", HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);
if (url.StartsWith(domainPrefix))
return url;
else
return domainPrefix + url;
}
}
Completely standard out of the box, with suggested fix, but still doesn't work. Using umbraco 7.2.1, CultivSearchEngineSitemap Razor 1.0.2, Robots.txt Editor and Cultiv Dynamic Robots.
Ar ok sorry the thing that gives problem is the if statement.
So try this, I think it would be a good starting point.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var rootNode = CurrentPage.AncestorOrself(1); }
@traverse(CurrentPage.AncestorOrSelf())
@helper traverse(dynamic node){ Response.ContentType = "text/xml"; const int maxLevelForSiteMap = 100; var nodes = node.Children.Where("Visible");
if (nodes.Any()) { foreach (var n in nodes) { var loc = "http://" + HttpContext.Current.Request.ServerVariables["HTTP_HOST"] + n.Url; <url> <loc>@loc</loc> <lastmod>@n.UpdateDate.ToString("yyyy-MM-dd")</lastmod> </url> @traverse(n) } } }
Topic author was deleted
Error loading razor version of Sitemap
I am having the same problem as what's been described here before, however the mentioned fix doesn't work for me.
Error loading Partial View script (file: ~/Views/MacroPartials/sitemapxml.cshtml)
I am using 7.2.1 with the latest razor package of CultivSearchEngineSitemap.
Does anyone have any ideas?
It's a complete fresh install, with Cultive Dynamic Robots and the robots.txt editor packages installed.
Hi Stephen,
When you are in the partial macro for the CultivSearchEngineSitemap, then try to chage this line
To
Hope this helps, solve your issue,
/Dennis
Comment author was deleted
As already mentioned, that fix doesn't appear to work.
Partial View
Completely standard out of the box, with suggested fix, but still doesn't work. Using umbraco 7.2.1, CultivSearchEngineSitemap Razor 1.0.2, Robots.txt Editor and Cultiv Dynamic Robots.
Template
I've even tried something like this as the template:
So I'm a bit confused as I say.
Hi Stephen,
Arh okay sorry did see not that. I have made some code that will works with Umbraco 7.2.
I hope this can be a solution for you or at least a good starting point.
Hope this helps,
/Dennis
Comment author was deleted
I'm affraid that doesn't work either.
It still comes up with the same error.
Error loading Partial View script (file: ~/Views/MacroPartials/sitemapxml.cshtml)
Has something major changed between like versions 7.1.4 and 7.2.1? or something?
Hi Stephen,
Ar ok sorry the thing that gives problem is the if statement.
So try this, I think it would be a good starting point.
Hope this helps,
/Dennis
Comment author was deleted
Dennis,
Many thanks for that, it works, and with a little tweaking it now works as intended.
One quick question I do have is how can I include the parent of my site nav?
My Current Site structure
Website Settings
- EN (Homepage)
- - About (Textpage)
- - Contact (Textpage)
- - Sitemap XML (Sitemap)
- DE (Homepage)
- - About (Textpage)
- - Contact (Textpage)
- - Sitemap XML (Sitemap)
At the moment, when using
It gets everything bellow EN, but not EN itself.
What gets outputted:
- - About (Textpage)
- - Contact (Textpage)
- - Sitemap XML (Sitemap)
It's not including EN (Homepage) - How would I achieve this?
Hi Stephen,
What if you change the:
To
or even without any digits in the AncestorOrSelf, does this include EN and DE folders.
Hope this helps,
/Dennis
Comment author was deleted
Sorry, I should probablly of mentioned that each language will have it's own sitemapxml.
So if I change from AncestorOrSelf(2) to AncestorOrSelf(1) - it does indeed include EN + Subpages & DE + Subpages.
If I change AncestorOrSelf(2) to AncestorOrSelf() - then it doesnt display anything.
So I need something in the middle of 1 & 2, haha. I need to start from level 2 (AncestorOrSelf(2)) but also include the parent/start node.
Or try to see Jeavons comments on this post http://our.umbraco.org/forum/developers/razor/43525-SiteMap-for-Umbraco-V6x-MVC-Engine-, how he add homepage to the XML sitemap.
/Dennis
is working on a reply...