<pre class='dw-error'>Error compiling template "Designs/Swift/Swift_Sitemap.xml.cshtml"
Line 53: The name 'RenderNodes' does not exist in the current context
Line 55: The name 'helper' does not exist in the current context
Line 57: The name 'RenderNode' does not exist in the current context
Line 57: The name 'node' does not exist in the current context
Line 59: The name 'helper' does not exist in the current context
Line 84: The name 'node' does not exist in the current context
Line 86: The name 'page' does not exist in the current context
Line 88: The name 'RenderEcommerceGroupNodes' does not exist in the current context
Line 88: The name 'page' does not exist in the current context
Line 88: The name 'node' does not exist in the current context
Line 88: The name 'productPageid' does not exist in the current context
Line 91: The name 'node' does not exist in the current context
Line 93: The name 'page' does not exist in the current context
Line 95: The name 'RenderNodes' does not exist in the current context
Line 95: The name 'node' does not exist in the current context
Line 97: The name 'helper' does not exist in the current context
Line 114: The name 'url' does not exist in the current context
Line 116: The name 'RenderEcommerceProductNodes' does not exist in the current context
Line 116: The name 'group' does not exist in the current context
Line 116: The name 'group' does not exist in the current context
Line 116: The name 'node' does not exist in the current context
Line 116: The name 'group' does not exist in the current context
Line 116: The name 'detailProductPageId' does not exist in the current context
Line 118: The name 'RenderEcommerceGroupNodes' does not exist in the current context
Line 118: The name 'group' does not exist in the current context
Line 118: The name 'node' does not exist in the current context
Line 118: The name 'detailProductPageId' does not exist in the current context
Line 120: The name 'helper' does not exist in the current context
Line 132: The name 'url' does not exist in the current context
Line 154: 'Shop' does not contain a definition for 'get_TopLevelGroups' and no accessible extension method 'get_TopLevelGroups' accepting a first argument of type 'Shop' could be found (are you missing a using directive or an assembly reference?)
Line 167: 'Shop' does not contain a definition for 'get_TopLevelGroups' and no accessible extension method 'get_TopLevelGroups' accepting a first argument of type 'Shop' could be found (are you missing a using directive or an assembly reference?)
<hr/>
<div class='source-code'>
<span class='line-number'>  1</span>     // &lt;auto-generated/&gt;
<span class='line-number'>  2</span>     #pragma warning disable 1591
<span class='line-number'>  3</span>     namespace CompiledRazorTemplates.Dynamic
<span class='line-number'>  4</span>     {
<span class='line-number'>  5</span>         #line hidden
<span class='line-number'>  6</span>         using System.Threading.Tasks;
<span class='line-number'>  7</span>         using System;
<span class='line-number'>  8</span>         using System.Collections.Generic;
<span class='line-number'>  9</span>         using System.Linq;
<span class='line-number'> 10</span>         using Dynamicweb.Ecommerce.Products;
<span class='line-number'> 11</span>         using Dynamicweb.Frontend.Navigation;
<span class='line-number'> 12</span>         internal class RazorEngine_afecf3816db34354989ca9886cff90ab : Dynamicweb.Rendering.ViewModelTemplate&lt;Dynamicweb.Frontend.PageViewModel&gt;
<span class='line-number'> 13</span>         {
<span class='line-number'> 14</span>             #pragma warning disable 1998
<span class='line-number'> 15</span>             public async override global::System.Threading.Tasks.Task ExecuteAsync()
<span class='line-number'> 16</span>             {
<span class='line-number'> 17</span>                 WriteLiteral(&quot;\n&quot;);
<span class='line-number'> 18</span>                   
	var masterArea = Pageview.Area;
	if (Pageview.Area.IsLanguage)
	{
		masterArea = Pageview.Area.MasterArea;
	}
	List&lt;int&gt; masterWebsiteAndLanguages = new List&lt;int&gt;();
	masterWebsiteAndLanguages.Add(masterArea.ID);
	if (masterArea.Languages is object &amp;&amp; masterArea.Languages.Any())
	{
		foreach (var language in masterArea.Languages)
		{
			masterWebsiteAndLanguages.Add(language.ID);
		}
	}
	string hostname = Dynamicweb.Context.Current.Request.Url.GetLeftPart(UriPartial.Authority);
	List&lt;NavigationTreeNodeViewModel&gt; allWebsiteAndLanguageNodes = new List&lt;NavigationTreeNodeViewModel&gt;();
	foreach (int areaid in masterWebsiteAndLanguages)
	{
		var navigationSettingsMain = new Dynamicweb.Frontend.Navigation.NavigationSettings()
		{
			StartLevel = 1,
			StopLevel = 10,
			RootAreaId = areaid,
			IncludeFoldersAndHidden = true,
			ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All
		};
		allWebsiteAndLanguageNodes.AddRange(GetNavigation(navigationSettingsMain)?.Nodes);
	}
            WriteLiteral(&quot;&lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot; ?&gt;\n&lt;urlset xmlns=\&quot;http://www.sitemaps.org/schemas/sitemap/0.9\&quot;&gt;\n\n&quot;);
<span class='line-number'> 19</span>                   Write(RenderNodes(allWebsiteAndLanguageNodes, hostname));
<span class='line-number'> 20</span>                 WriteLiteral(&quot;\n&lt;/urlset&gt;\n\n&quot;);
<span class='line-number'> 21</span>                 Write(helper);
<span class='line-number'> 22</span>                 WriteLiteral(&quot; RenderNodes(IEnumerable&lt;NavigationTreeNodeViewModel&gt; nodes, string hostname)\n{\n\tforeach (NavigationTreeNodeViewModel node in nodes)\n\t{\n\t\t&quot;);
<span class='line-number'> 23</span>                    Write(RenderNode(node, hostname));
<span class='line-number'> 24</span>                 WriteLiteral(&quot;\n\n\t}\n}\n\n&quot;);
<span class='line-number'> 25</span>                 Write(helper);
<span class='line-number'> 26</span>                 WriteLiteral(@&quot; RenderNode(NavigationTreeNodeViewModel node, string hostname)
{
	var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId);
	bool isEcommerceNavigation = false;
	string navsettings = string.Empty;
	if (page.NavigationSettings != null &amp;&amp; page.NavigationSettings.UseEcomGroups)
	{
		isEcommerceNavigation = true;
		navsettings = page.NavigationSettings.Groups;
	}
	if (isEcommerceNavigation)
	{
		if (page.Allowclick &amp;&amp; page.ShowInSitemap &amp;&amp; !page.Noindex)
		{
			var productPageid = node.PageId;
            if (!string.IsNullOrEmpty(page.NavigationSettings.ProductPage)) { 
				productPageid = Dynamicweb.Environment.Helpers.LinkHelper.GetInternalPageId(page.NavigationSettings.ProductPage);
			}
			&lt;url&gt;
&quot;);
<span class='line-number'> 27</span>                 WriteLiteral(&quot;\t\t\t\t&lt;loc&gt;&quot;);
<span class='line-number'> 28</span>                                 Write(hostname);
<span class='line-number'> 29</span>                                          Write(node.Link);
<span class='line-number'> 30</span>                 WriteLiteral(&quot;&lt;/loc&gt;\n\t\t\t\t&lt;lastmod&gt;&quot;);
<span class='line-number'> 31</span>                                     Write(page.Audit.LastModifiedAt.ToString(&quot;s&quot;));
<span class='line-number'> 32</span>                 WriteLiteral(&quot;&lt;/lastmod&gt;\n\t\t\t&lt;/url&gt;\n\n\t\t\t&quot;);
<span class='line-number'> 33</span>                        Write(RenderEcommerceGroupNodes(GetGroupsBySettings(page.NavigationSettings), node, hostname, productPageid));
<span class='line-number'> 34</span>                 WriteLiteral(&quot;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (page.Allowclick &amp;&amp; page.ShowInSitemap &amp;&amp; !page.Noindex)\n\t\t{\n\t\t\t&lt;url&gt;\n\t\t\t\t&lt;loc&gt;&quot;);
<span class='line-number'> 35</span>                                 Write(hostname);
<span class='line-number'> 36</span>                                          Write(node.Link);
<span class='line-number'> 37</span>                 WriteLiteral(&quot;&lt;/loc&gt;\n\t\t\t\t&lt;lastmod&gt;&quot;);
<span class='line-number'> 38</span>                                     Write(page.Audit.LastModifiedAt.ToString(&quot;s&quot;));
<span class='line-number'> 39</span>                 WriteLiteral(&quot;&lt;/lastmod&gt;\n\t\t\t&lt;/url&gt;\n\t\t}\n\t\tif (node.Nodes.Any())\n\t\t{\n\t\t\t&quot;);
<span class='line-number'> 40</span>                        Write(RenderNodes(node.Nodes, hostname));
<span class='line-number'> 41</span>                 WriteLiteral(&quot;\n\t\t}\n\t}\n}\n\n&quot;);
<span class='line-number'> 42</span>                 Write(helper);
<span class='line-number'> 43</span>                 WriteLiteral(@&quot; RenderEcommerceGroupNodes(IEnumerable&lt;Dynamicweb.Ecommerce.Products.Group&gt; groups, NavigationTreeNodeViewModel node, string hostname, int detailProductPageId)
{
	foreach (Group group in groups)
	{
		if (group.NavigationClickable &amp;&amp; group.NavigationShowInSiteMap)
		{
			//Remember to check if this group is not having another primary page
			//Remember to check if this group does not have multiple parents - and if it has, decide if the group should be shown here
			//int primarypageid = group.Meta.PrimaryPageId; //Use this if needed - send it into the product
			string url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(&quot;&quot;Default.aspx?ID=&quot;&quot; + node.PageId + &quot;&quot;&amp;GroupID=&quot;&quot; + group.IdUrlEncoded);
			&lt;url&gt;
&quot;);
<span class='line-number'> 44</span>                 WriteLiteral(&quot;\t\t\t\t&lt;loc&gt;&quot;);
<span class='line-number'> 45</span>                                 Write(hostname);
<span class='line-number'> 46</span>                                          Write(url);
<span class='line-number'> 47</span>                 WriteLiteral(&quot;&lt;/loc&gt;\n\t\t\t&lt;/url&gt;\n\t\t}\n\t\t&quot;);
<span class='line-number'> 48</span>                    Write(RenderEcommerceProductNodes(Dynamicweb.Ecommerce.Services.Products.GetProductsByGroupId(group.Id, true, group.LanguageId, false), node, hostname, group, detailProductPageId));
<span class='line-number'> 49</span>                 WriteLiteral(&quot;\n\t\t&quot;);
<span class='line-number'> 50</span>                    Write(RenderEcommerceGroupNodes(group.Subgroups, node, hostname, detailProductPageId));
<span class='line-number'> 51</span>                 WriteLiteral(&quot;\n\n\t}\n}\n\n&quot;);
<span class='line-number'> 52</span>                 Write(helper);
<span class='line-number'> 53</span>                 WriteLiteral(@&quot; RenderEcommerceProductNodes(IEnumerable&lt;Dynamicweb.Ecommerce.Products.Product&gt; products, NavigationTreeNodeViewModel node, string hostname, Group group, int detailProductPageId)
{
	//Locate the right pageid. This group is shown on a page that might link to another page to show product detail. So on this page, find the paragraph, lookup the setting, change pageid to the detail page.
	//The product might be in 2 groups - ensure this is the primary or default group of the product - if not, do not render
	foreach (Product product in products)
	{
		string url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(&quot;&quot;Default.aspx?ID=&quot;&quot; + detailProductPageId + &quot;&quot;&amp;GroupID=&quot;&quot; + group.IdUrlEncoded + &quot;&quot;&amp;ProductID=&quot;&quot; + product.Id);
		&lt;url&gt;
&quot;);
<span class='line-number'> 54</span>                 WriteLiteral(&quot;\t\t\t&lt;loc&gt;&quot;);
<span class='line-number'> 55</span>                             Write(hostname);
<span class='line-number'> 56</span>                                      Write(url);
<span class='line-number'> 57</span>                 WriteLiteral(&quot;&lt;/loc&gt;\n\t\t&lt;/url&gt;\n\t}\n}\n\n&quot;);
<span class='line-number'> 58</span>             }
<span class='line-number'> 59</span>             #pragma warning restore 1998
<span class='line-number'> 60</span>                        
	public IEnumerable&lt;Dynamicweb.Ecommerce.Products.Group&gt; GetGroupsBySettings(Dynamicweb.Content.PageNavigationSettings ecomSettings)
	{
		IEnumerable&lt;Dynamicweb.Ecommerce.Products.Group&gt; topLevelGroups;
		string languageId = Dynamicweb.Ecommerce.Common.Context.LanguageID;
		switch (ecomSettings.ParentType)
		{
			case Dynamicweb.Content.EcommerceNavigationParentType.Groups:
				{
					Dynamicweb.Ecommerce.Extensibility.Controls.ProductsAndGroupsHandler groupHandler = new Dynamicweb.Ecommerce.Extensibility.Controls.ProductsAndGroupsHandler(ecomSettings.Groups);
					if (groupHandler.Type == Dynamicweb.Ecommerce.Extensibility.Controls.HandlerConfigurationType.All)
					{
						Dynamicweb.Ecommerce.Shops.Shop shop = Dynamicweb.Ecommerce.Services.Shops.GetShop(string.IsNullOrEmpty(groupHandler.ShopSelected) ? ecomSettings.ShopID : groupHandler.ShopSelected);
						if (shop == null)
							topLevelGroups = Enumerable.Empty&lt;Dynamicweb.Ecommerce.Products.Group&gt;();
						else
							topLevelGroups = shop.get_TopLevelGroups(languageId);
					}
					else
						topLevelGroups = groupHandler.GroupsSelected;
					break;
				}
			case Dynamicweb.Content.EcommerceNavigationParentType.Shop:
				{
					Dynamicweb.Ecommerce.Shops.Shop shop = Dynamicweb.Ecommerce.Services.Shops.GetShop(ecomSettings.ShopID);
					if (shop == null)
						topLevelGroups = Enumerable.Empty&lt;Dynamicweb.Ecommerce.Products.Group&gt;();
					else
						topLevelGroups = shop.get_TopLevelGroups(languageId);
					break;
				}
			default:
				{
					topLevelGroups = Enumerable.Empty&lt;Dynamicweb.Ecommerce.Products.Group&gt;();
					break;
				}
		}
		return topLevelGroups;
	}
    }
<span class='line-number'> 61</span>     }
<span class='line-number'> 62</span>     #pragma warning restore 1591
<span class='line-number'> 63</span>     
</div>
<hr/>
<div class='template-code'>
<span class='line-number'>  1</span>     @inherits Dynamicweb.Rendering.ViewModelTemplate&lt;Dynamicweb.Frontend.PageViewModel&gt;
@using System;
@using System.Collections.Generic;
@using System.Linq;
@using Dynamicweb.Ecommerce.Products;
@using Dynamicweb.Frontend.Navigation;
@{
	var masterArea = Pageview.Area;
	if (Pageview.Area.IsLanguage)
	{
		masterArea = Pageview.Area.MasterArea;
	}
	List&lt;int&gt; masterWebsiteAndLanguages = new List&lt;int&gt;();
	masterWebsiteAndLanguages.Add(masterArea.ID);
	if (masterArea.Languages is object &amp;&amp; masterArea.Languages.Any())
	{
		foreach (var language in masterArea.Languages)
		{
			masterWebsiteAndLanguages.Add(language.ID);
		}
	}
	string hostname = Dynamicweb.Context.Current.Request.Url.GetLeftPart(UriPartial.Authority);
	List&lt;NavigationTreeNodeViewModel&gt; allWebsiteAndLanguageNodes = new List&lt;NavigationTreeNodeViewModel&gt;();
	foreach (int areaid in masterWebsiteAndLanguages)
	{
		var navigationSettingsMain = new Dynamicweb.Frontend.Navigation.NavigationSettings()
		{
			StartLevel = 1,
			StopLevel = 10,
			RootAreaId = areaid,
			IncludeFoldersAndHidden = true,
			ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All
		};
		allWebsiteAndLanguageNodes.AddRange(GetNavigation(navigationSettingsMain)?.Nodes);
	}
}
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
&lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&gt;
	@{ @RenderNodes(allWebsiteAndLanguageNodes, hostname) }
&lt;/urlset&gt;
@helper RenderNodes(IEnumerable&lt;NavigationTreeNodeViewModel&gt; nodes, string hostname)
{
	foreach (NavigationTreeNodeViewModel node in nodes)
	{
		@RenderNode(node, hostname)
	}
}
@helper RenderNode(NavigationTreeNodeViewModel node, string hostname)
{
	var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId);
	bool isEcommerceNavigation = false;
	string navsettings = string.Empty;
	if (page.NavigationSettings != null &amp;&amp; page.NavigationSettings.UseEcomGroups)
	{
		isEcommerceNavigation = true;
		navsettings = page.NavigationSettings.Groups;
	}
	if (isEcommerceNavigation)
	{
		if (page.Allowclick &amp;&amp; page.ShowInSitemap &amp;&amp; !page.Noindex)
		{
			var productPageid = node.PageId;
            if (!string.IsNullOrEmpty(page.NavigationSettings.ProductPage)) { 
				productPageid = Dynamicweb.Environment.Helpers.LinkHelper.GetInternalPageId(page.NavigationSettings.ProductPage);
			}
			&lt;url&gt;
				@*&lt;loc pageid=&quot;@node.PageId&quot; groups=&quot;@navsettings&quot;&gt;@hostname@node.Link&lt;/loc&gt;*@
				&lt;loc&gt;@hostname@node.Link&lt;/loc&gt;
				&lt;lastmod&gt;@page.Audit.LastModifiedAt.ToString(&quot;s&quot;)&lt;/lastmod&gt;
			&lt;/url&gt;
			@RenderEcommerceGroupNodes(GetGroupsBySettings(page.NavigationSettings), node, hostname, productPageid)
		}
	}
	else
	{
		if (page.Allowclick &amp;&amp; page.ShowInSitemap &amp;&amp; !page.Noindex)
		{
			&lt;url&gt;
				&lt;loc&gt;@hostname@node.Link&lt;/loc&gt;
				&lt;lastmod&gt;@page.Audit.LastModifiedAt.ToString(&quot;s&quot;)&lt;/lastmod&gt;
			&lt;/url&gt;
		}
		if (node.Nodes.Any())
		{
			@RenderNodes(node.Nodes, hostname)
		}
	}
}
@helper RenderEcommerceGroupNodes(IEnumerable&lt;Dynamicweb.Ecommerce.Products.Group&gt; groups, NavigationTreeNodeViewModel node, string hostname, int detailProductPageId)
{
	foreach (Group group in groups)
	{
		if (group.NavigationClickable &amp;&amp; group.NavigationShowInSiteMap)
		{
			//Remember to check if this group is not having another primary page
			//Remember to check if this group does not have multiple parents - and if it has, decide if the group should be shown here
			//int primarypageid = group.Meta.PrimaryPageId; //Use this if needed - send it into the product
			string url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(&quot;Default.aspx?ID=&quot; + node.PageId + &quot;&amp;GroupID=&quot; + group.IdUrlEncoded);
			&lt;url&gt;
				@*&lt;loc pageid=&quot;@node.PageId&quot; groupid=&quot;@group.Id&quot; group=&quot;@Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(group.Name)&quot;&gt;@hostname@url&lt;/loc&gt;*@
				&lt;loc&gt;@hostname@url&lt;/loc&gt;
			&lt;/url&gt;
		}
		@RenderEcommerceProductNodes(Dynamicweb.Ecommerce.Services.Products.GetProductsByGroupId(group.Id, true, group.LanguageId, false), node, hostname, group, detailProductPageId)
		@RenderEcommerceGroupNodes(group.Subgroups, node, hostname, detailProductPageId)
	}
}
@helper RenderEcommerceProductNodes(IEnumerable&lt;Dynamicweb.Ecommerce.Products.Product&gt; products, NavigationTreeNodeViewModel node, string hostname, Group group, int detailProductPageId)
{
	//Locate the right pageid. This group is shown on a page that might link to another page to show product detail. So on this page, find the paragraph, lookup the setting, change pageid to the detail page.
	//The product might be in 2 groups - ensure this is the primary or default group of the product - if not, do not render
	foreach (Product product in products)
	{
		string url = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(&quot;Default.aspx?ID=&quot; + detailProductPageId + &quot;&amp;GroupID=&quot; + group.IdUrlEncoded + &quot;&amp;ProductID=&quot; + product.Id);
		&lt;url&gt;
			@*&lt;loc pageid=&quot;@node.PageId&quot; detailpageid=&quot;@detailProductPageId&quot; groupid=&quot;@group.Id&quot; group=&quot;@Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(group.Name)&quot; productid=&quot;@product.Id&quot; product=&quot;@Dynamicweb.Core.Encoders.HtmlEncoder.HtmlEncode(product.Name)&quot; variantid=&quot;@product.VariantId&quot;&gt;@hostname@url&lt;/loc&gt;*@
			&lt;loc&gt;@hostname@url&lt;/loc&gt;
		&lt;/url&gt;
	}
}
@functions{
	public IEnumerable&lt;Dynamicweb.Ecommerce.Products.Group&gt; GetGroupsBySettings(Dynamicweb.Content.PageNavigationSettings ecomSettings)
	{
		IEnumerable&lt;Dynamicweb.Ecommerce.Products.Group&gt; topLevelGroups;
		string languageId = Dynamicweb.Ecommerce.Common.Context.LanguageID;
		switch (ecomSettings.ParentType)
		{
			case Dynamicweb.Content.EcommerceNavigationParentType.Groups:
				{
					Dynamicweb.Ecommerce.Extensibility.Controls.ProductsAndGroupsHandler groupHandler = new Dynamicweb.Ecommerce.Extensibility.Controls.ProductsAndGroupsHandler(ecomSettings.Groups);
					if (groupHandler.Type == Dynamicweb.Ecommerce.Extensibility.Controls.HandlerConfigurationType.All)
					{
						Dynamicweb.Ecommerce.Shops.Shop shop = Dynamicweb.Ecommerce.Services.Shops.GetShop(string.IsNullOrEmpty(groupHandler.ShopSelected) ? ecomSettings.ShopID : groupHandler.ShopSelected);
						if (shop == null)
							topLevelGroups = Enumerable.Empty&lt;Dynamicweb.Ecommerce.Products.Group&gt;();
						else
							topLevelGroups = shop.get_TopLevelGroups(languageId);
					}
					else
						topLevelGroups = groupHandler.GroupsSelected;
					break;
				}
			case Dynamicweb.Content.EcommerceNavigationParentType.Shop:
				{
					Dynamicweb.Ecommerce.Shops.Shop shop = Dynamicweb.Ecommerce.Services.Shops.GetShop(ecomSettings.ShopID);
					if (shop == null)
						topLevelGroups = Enumerable.Empty&lt;Dynamicweb.Ecommerce.Products.Group&gt;();
					else
						topLevelGroups = shop.get_TopLevelGroups(languageId);
					break;
				}
			default:
				{
					topLevelGroups = Enumerable.Empty&lt;Dynamicweb.Ecommerce.Products.Group&gt;();
					break;
				}
		}
		return topLevelGroups;
	}
}
</div>
</pre>
