Sitemap Navigator
Using Sitemap Navigator in Code
You can use Composite.Data.SitemapNavigator
to get access to the C1 CMS sitemap structure and primary page attributes.
Sample:
using System; using Composite.Data; using Composite.Core; namespace Demo { public class Class6 { public static void CurrentPageViewed() { using (DataConnection dataConnection = new DataConnection()) { SitemapNavigator sitemapNavigator = new SitemapNavigator(dataConnection); Log.LogInformation("Demo", "The page {0} has been just viewed", sitemapNavigator.CurrentPageNode.Title); } } } }
In the sample, we use DataConnection to get a new SitemapNavigator
instance, then we get a PageNode instance of the current page (CurrentPageNode
), and finally, get and use the title of the page (Title
).