コード例 #1
0
        /// <summary>
        /// Prepare the breadcrumbs model for this view.
        /// </summary>
        /// <param name="package"></param>
        private void ConfigureBreadCrumbs(Package package)
        {
            // Set up the breadcrumbs for this action
            var breadCrumbs = new BreadCrumbs();

            breadCrumbs.Add(new BreadCrumb(
                SettingsHelper.GetCatalogBreadcrumbsBaseLabel(),
                "Index",
                "Home"));

            breadCrumbs.Add(new BreadCrumb(
                package.Title));

            ViewData["BreadCrumbs"] = breadCrumbs;
        }
コード例 #2
0
        /// <summary>
        /// Prepare the meta tags for this view.
        /// </summary>
        /// <param name="package">The package</param>
        private void ConfigureMetaTags(Package package)
        {
            var metaTags = new MetaTags();

            // Set the description from the package summary
            metaTags.Description = package.GetAbbreviatedNotes(SettingsHelper.GetSeoPackageDescriptionLength());

            // Get the common keywords from the settings
            var keywords = SettingsHelper.GetSeoCommonPackageKeywords();

            // Add the tags from the package
            keywords.AddRange(package.Tags);

            // Convert the list into a comma-delimited string
            var keywordsString = String.Join(",", keywords.ToArray());

            // Replace CKAN hyphens with spaces
            keywordsString = keywordsString.Replace("-", " ");

            // Set the page keywords
            metaTags.Keywords = keywordsString;
            
            ViewData["MetaTags"] = metaTags;
        }
コード例 #3
0
        /// <summary>
        /// Filter the package title with the package title prefix.
        /// </summary>
        /// <param name="package"></param>
        public static void FilterTitle(Package package)
        {
            string title = package.Title;
            string titlePrefix = GetCatalogPackageTitlePrefix();
            if (!String.IsNullOrEmpty(titlePrefix))
            {
                package.Title = title.Replace(titlePrefix, "");
            }

        }