private void SetOpenGraphMetadata(PublicProfile profile)
        {
            if (profile != null)
            {
                ViewBag.Title = profile.FullName;

                ViewBag.Og = new OpenGraphMetadata
                {
                    Title       = profile.FullName,
                    Description = $"Науковий ступень: {profile.AcademicDegree}. Наукові інтереси: {profile.GetField("ScientificInterest")}. Вчене звання: {profile.AcademicStatus}",
                    Image       = profile.Photo,
                    SiteName    = "Intellect - КПІ ім. Ігоря Сікорського",
                    Url         = CampusClient.GetProfileCanonicalUrl(profile).ToString()
                };
            }
        }
        private IActionResult SubpageTemplate(string userIdentifier)
        {
            var profile = Client.GetUserProfile(userIdentifier);

            if (profile == null)
            {
                return(Redirect("~/NotFound"));
            }

            var url = CampusClient.GetProfileCanonicalUrl(profile);

            if (Request.Host.Host != url.Host && Request.Host.Host != "localhost")
            {
                return(RedirectPermanent(url.ToString()));
            }

            SetPageHeaderBackground();

            SetOpenGraphMetadata(profile);

            return(View(profile));
        }
        public IActionResult Index(string userIdentifier)
        {
            var profile = Client.GetUserProfile(userIdentifier);

            if (profile == null)
            {
                return(Redirect("~/NotFound"));
            }

            var url = CampusClient.GetProfileCanonicalUrl(profile);

            if (Request?.Host.Host != url.Host && Request?.Host.Host != "localhost")
            {
                return(RedirectPermanent(url.ToString()));
            }

            SetPageHeaderBackground();

            ViewBag.ProfileName = userIdentifier;

            var position = CampusClient.GetUserPrimaryPosition(profile);

            if (!String.IsNullOrEmpty(position?.Subdivision.Url))
            {
                try
                {
                    var uri = new Uri(position.Subdivision.Url);
                    ViewBag.Link = $"http://intellect.{uri.Host}/profile/{profile.UserIdentifier}";
                }
                catch { }
            }

            SetOpenGraphMetadata(profile);

            return(View(profile));
        }