public string GetSeoPattern(SeoParameterType type, string contentType)
 {
     if (!SeoPatternsDictionary.ContainsKey(type) || !SeoPatternsDictionary[type].ContainsKey(contentType))
     {
         return(null);
     }
     return(SeoPatternsDictionary[type][contentType]);
 }
 public void SetSeoPattern(SeoParameterType type, string contentType, string pattern)
 {
     if (!SeoPatternsDictionary.ContainsKey(type))
     {
         SeoPatternsDictionary[type] = new Dictionary <string, string>();
     }
     SeoPatternsDictionary[type][contentType] = pattern;
     SaveSeoPatternsDictionary();
 }
        public string GenerateSeoParameter(SeoParameterType type, IContent content)
        {
            var globalSettings = _seoSettingsManager.GetGlobalSettings();
            var pattern = globalSettings.GetSeoPattern(type, content.ContentItem.ContentType);
            if (String.IsNullOrEmpty(pattern)) return null;

            return _tokenizer.Replace(
                        pattern,
                        new Dictionary<string, object> { { "Content", content } },
                        new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
        }
        private IDictionary <string, string> GetSeoPatternsViewDictionary(SeoParameterType type)
        {
            if (!SeoPatternsViewDictionary.ContainsKey(type))
            {
                var viewDictionary = SeoPatternsViewDictionary[type] = SeoContentTypes.ToDictionary(definition => definition.Name, definition => "");

                if (SeoPatternsDictionary.Count != 0 && SeoPatternsDictionary.ContainsKey(type))
                {
                    foreach (var pattern in SeoPatternsDictionary[type])
                    {
                        viewDictionary[pattern.Key] = pattern.Value;
                    }
                }
            }

            return(SeoPatternsViewDictionary[type]);
        }
示例#5
0
        public string GenerateSeoParameter(SeoParameterType type, IContent content)
        {
            var globalSettings = _seoSettingsManager.GetGlobalSettings();
            var pattern        = globalSettings.GetSeoPattern(type, content.ContentItem.ContentType);

            if (String.IsNullOrEmpty(pattern))
            {
                return(null);
            }

            return(_tokenizer.Replace(
                       pattern,
                       new Dictionary <string, object> {
                { "Content", content }
            },
                       new ReplaceOptions {
                Encoding = ReplaceOptions.NoEncode
            }));
        }
 private void SetSeoPatternsViewDictionary(SeoParameterType type, IDictionary <string, string> dictionary)
 {
     SeoPatternsViewDictionary[type] = dictionary;
     SeoPatternsDictionary[type]     = dictionary;
     SaveSeoPatternsDictionary();
 }