コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="searchModel">The search model to be output as metatags</param>
        /// <param name="onlyShowIfCrawlerOrDebug">Only output the metatags if the request is from the crawler or the application is in debug mode.</param>
        /// <returns></returns>
        public static string OutputMetaFor(SearchModelBase searchModel, bool onlyShowIfCrawlerOrDebug = true)
        {
            if (searchModel == null)
                return "<!-- Searchmodel was null -->";

            if(onlyShowIfCrawlerOrDebug && !HttpContext.Current.Request.IsSeekitCrawler() && !HttpContext.Current.IsDebuggingEnabled) {
                return string.Empty;
            }

            var generator = new MarkupGenerator();
            return generator.GenerateMetaTags(searchModel);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="searchModel">The search model to be output as metatags</param>
        /// <param name="onlyShowIfCrawlerOrDebug">Only output the metatags if the request is from the crawler or the application is in debug mode.</param>
        /// <returns></returns>
        public static string OutputMetaFor(SearchModelBase searchModel, bool onlyShowIfCrawlerOrDebug = true)
        {
            if (searchModel == null)
            {
                return("<!-- Searchmodel was null -->");
            }

            if (onlyShowIfCrawlerOrDebug && !HttpContext.Current.Request.IsSeekitCrawler() && !HttpContext.Current.IsDebuggingEnabled)
            {
                return(string.Empty);
            }

            var generator = new MarkupGenerator();

            return(generator.GenerateMetaTags(searchModel));
        }