예제 #1
0
        public virtual OpenGraphObject GetOpenGraphObject(string url)
        {
            if (url.IsNullOrWhiteSpace())
            {
                return(null);
            }

            var uri     = new UriBuilder(url).Uri;
            var content = HttpContext.Current.Request.Url.Host.Equals(uri.Host) ?
                          _umbracoHelper.UmbracoContext.ContentCache.GetByRoute(uri.GetAbsolutePathDecoded()) : null;

            if (content == null)
            {
                return(null);
            }

            if (content.DocumentTypeAlias.InvariantEquals(_documentTypeAliasProvider.GetBulletinsDetailsPage()) ||
                content.DocumentTypeAlias.InvariantEquals(_documentTypeAliasProvider.GetEventsDetailsPage()) ||
                content.DocumentTypeAlias.InvariantEquals(_documentTypeAliasProvider.GetNewsDetailsPage()))
            {
                return(Guid.TryParse(HttpUtility.ParseQueryString(uri?.Query ?? "").Get(_queryStringIdKey), out var id) ?
                       GetOpenGraphObject(id, url) : null);
            }
            else
            {
                return(GetOpenGraphObject(content, url));
            };
        }
예제 #2
0
 private bool IsActivityDetailsPage(INodeModel content) =>
 content.ContentTypeAlias.InvariantEquals(_documentTypeAliasProvider.GetBulletinsDetailsPage()) ||
 content.ContentTypeAlias.InvariantEquals(_documentTypeAliasProvider.GetEventsDetailsPage()) ||
 content.ContentTypeAlias.InvariantEquals(_documentTypeAliasProvider.GetNewsDetailsPage());