Exemplo n.º 1
0
        public void Register(MetaTagsPart part)
        {
            var customMetaTags = part.GetCustom();
            var description    = part.GetDescription();
            var imagePath      = part.GetImage();
            var noIndex        = part.GetNoIndex();
            var title          = part.GetTitle();

            if (string.IsNullOrWhiteSpace(title))
            {
                title = part.ContentItem.DisplayText;
            }

            RegisterCustom(customMetaTags);
            RegisterDefaults(title, description, customMetaTags);
            RegisterNoIndex(noIndex, customMetaTags);
            RegisterOpenGraph(title, description, imagePath, customMetaTags);
            RegisterTwitter(title, description, imagePath, customMetaTags);
        }
        public async Task RegisterAsync(MetaTagsPart part)
        {
            _site = await _siteService.GetSiteSettingsAsync();

            var defaultMetaTags = await GetDefaultMetaTagsAsync(_site, part);

            var customMetaTags = part.GetCustom(defaultMetaTags.Custom);
            var description    = part.GetDescription() ?? defaultMetaTags.Description;
            var imagePath      = part.GetImage() ?? defaultMetaTags.ImagePath;
            var noIndex        = part.GetNoIndex();
            var title          = part.GetTitle() ?? defaultMetaTags.Title;

            if (string.IsNullOrWhiteSpace(title))
            {
                title = part.ContentItem.DisplayText;
            }

            RegisterCustom(customMetaTags);
            RegisterDefaults(title, description, customMetaTags);
            RegisterNoIndex(noIndex, customMetaTags);
            RegisterOpenGraph(title, description, imagePath, customMetaTags);
            RegisterTwitter(title, description, imagePath, customMetaTags);
        }