public static List <SiteMapUrl> GetSiteMapUrls(ControllerContext context) { var urlSet = new List <SiteMapUrl>(); // Populate the URL set var packages = CkanHelper.GetAllPackages(); // Get the base url UrlHelper helper = new UrlHelper(context.RequestContext); var request = context.RequestContext.HttpContext.Request; // TODO: Allow this to overridden in settings to support a reverse proxy var baseUrl = SettingsHelper.GetSeoSiteMapBaseUrl(); if (String.IsNullOrEmpty(baseUrl)) { baseUrl = request.Url.GetLeftPart(UriPartial.Authority) + request.ApplicationPath; } var baseUri = new Uri(baseUrl); AddHomepageToSiteMap(urlSet, packages, baseUri); AddPackagesToSiteMap(urlSet, packages, helper, baseUri); return(urlSet); }
/// <summary> /// Provides a view of features packages that have recently bee updated in the repository group. /// Return the three most recently updated packages in the group. /// </summary> public ActionResult RecentlyUpdated() { log.DebugFormat("Controller action requested"); // Create the CKAN search parameters var searchParameters = new PackageSearchParameters(); searchParameters.Groups.Add(SettingsHelper.GetCatalogGroup()); // Collect the results List <Package> packages = CkanHelper.GetAllPackages(); // Sort by date and take the top 3 packages = (from package in packages orderby package.MetadataModified descending select package) .Take(3) .ToList(); SettingsHelper.FilterTitles(packages); // Update the results to the top 3 PackageSearchResponse <Package> response = new PackageSearchResponse <Package>(); response.Results = packages; response.Count = packages.Count; // Populate the model PackageSearchResultsModel model = new PackageSearchResultsModel(); model.SearchResults = response; // Render the view return(View(model)); }