Ejemplo n.º 1
0
        public IActionResult Index()
        {
            try
            {
                // If configured to redirect to static (most likely prod)
                if (ShouldRedirectToStaticPage)
                {
                    Task.Run(() => Logger.LogWarning(new EventId(1, "Request for root received."), "Request for root received."));
                    return(this.RedirectPermanent("https://www.cascadianaerialrobotics.com"));
                }

                // Proceed normally
                var pageinfo = new PageMetadataModel
                {
                    Page        = "Cascadian Aerial Robotics LLC - Drone mapping, photogrammetry and GIS services in the Pacific Northwest",
                    Description = "Cascadian Aerial Robotics LLC offers drone and mapping services to Washington State and the Pacific Northwest in general."
                };

                return(View(new CommonComponentModel {
                    PubliclyExposedStringsProvider = this.PubliclyExposedStringsProvider, Metadata = pageinfo
                }));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, "Something went wrong when accesing the site from Index");
                return(this.RedirectPermanent("https://www.cascadianaerialrobotics.com"));
            }
        }
Ejemplo n.º 2
0
        public PageMetadataModel Build(Item item)
        {
            var urlOptions = (UrlOptions)UrlOptions.DefaultOptions.Clone();

            urlOptions.AlwaysIncludeServerUrl = true;
            urlOptions.LanguageEmbedding      = LanguageEmbedding.Never;

            var model = new PageMetadataModel
            {
                BrowserTitle = item.Fields.GetValue(PageMetaFieldsFieldIDs.BrowserTitle)
                               .Or(item.DisplayName).Or(item.Name),

                OgSiteName    = item.Fields.GetValue(OpenGraphMetaFieldIDs.OgSiteName),
                OgType        = item.Fields.GetValue(OpenGraphMetaFieldIDs.OgType),
                OgTitle       = item.Fields.GetValue(OpenGraphMetaFieldIDs.OgTitle),
                OgDescription = item.Fields.GetValue(OpenGraphMetaFieldIDs.OgDescription),

                MetaKeywords    = item.Fields.GetValue(PageMetaFieldsFieldIDs.MetaKeywords),
                MetaDescription = item.Fields.GetValue(PageMetaFieldsFieldIDs.MetaDescription),

                Language     = item.Language.CultureInfo.Name,
                LastModified = item.Statistics.Updated,
                Url          = LinkManager.GetItemUrl(item, urlOptions)
            };

            model.CanonicalUrl = GetCanonicalUrl(item);
            model.RobotsMeta   = GetRobotsMeta(item);
            model.OgImage      = GetOgImage(item);

            return(model);
        }
Ejemplo n.º 3
0
        private static ConcurrentDictionary <string, PageMetadataModel> GenerateListOfPageMetadata(
            PageMetadataSettings settings
            )
        {
            var pageList         = new Dictionary <string, PageMetadataModel>();
            var pageFileNameList = new List <string>();
            // Get All Pages
            var pageMetadataList = settings.PageAssemblyList
                                   .SelectMany(x => x.DefinedTypes)
                                   .Where(type => typeof(PageMetadata).IsAssignableFrom(type));

            foreach (var typeInfo in pageMetadataList)
            {
                if (Attribute.IsDefined(
                        typeInfo,
                        typeof(PageAttribute),
                        false
                        ))
                {
                    var pageAttribute  = typeInfo.GetCustomAttribute <PageAttribute>();
                    var routeAttribute = typeInfo.GetCustomAttribute <RouteAttribute>();
                    pageFileNameList.Add(
                        typeInfo.Name
                        );
                    if (routeAttribute == null)
                    {
                        throw new SystemException(
                                  $"Page Metadata needs a RouteAttribute to function: {typeInfo.Name}"
                                  );
                    }
                    var metadataFileName = $"{typeInfo.Name}.razor.json";
                    var model            = new PageMetadataModel
                    {
                        Title = typeInfo.Name,
                    };
                    // If has the PageMetadata Attribute pull data from that first
                    if (Attribute.IsDefined(
                            typeInfo,
                            typeof(PageMetadataAttribute)
                            ))
                    {
                        var pageMetadataAttribute = typeInfo.GetCustomAttribute <PageMetadataAttribute>();
                        model.Title = pageMetadataAttribute?.Title ?? string.Empty;
                    }

                    model.Route = routeAttribute.Template;

                    pageList.Add(
                        routeAttribute.Template,
                        model
                        );
                }
            }

            return(new ConcurrentDictionary <string, PageMetadataModel>(
                       pageList
                       ));
        }
Ejemplo n.º 4
0
        public IActionResult Bookings()
        {
            // If configured to redirect to static (most likely prod)
            if (ShouldRedirectToStaticPage)
            {
                Task.Run(() => Logger.LogWarning(new EventId(1, "Request for non-root received." + this.HttpContext.Request.Path.Value), "Request for root received."));
                return(this.RedirectPermanent("https://www.cascadianaerialrobotics.com"));
            }

            var pageinfo = new PageMetadataModel
            {
                Page        = "Bookings | Cascadian Aerial Robotics LLC",
                Description = "Book a meeting or call with Cascadian Aerial Robotics."
            };

            return(View("Bookings", new CommonComponentModel {
                PubliclyExposedStringsProvider = this.PubliclyExposedStringsProvider, Metadata = pageinfo
            }));
        }
Ejemplo n.º 5
0
        public IActionResult Newsletter()
        {
            // If configured to redirect to static (most likely prod)
            if (ShouldRedirectToStaticPage)
            {
                Task.Run(() => Logger.LogWarning(new EventId(1, "Request for non-root received." + this.HttpContext.Request.Path.Value), "Request for root received."));
                return(this.RedirectPermanent("https://www.cascadianaerialrobotics.com"));
            }

            var pageinfo = new PageMetadataModel
            {
                Page        = "Feathered flight: The Cascadian Aerial Robotics newsletter",
                Description = "The current issue of Feathered flight, the Cascadian Aerial Robotics newsletter."
            };

            return(View("Newsletter", new CommonComponentModel {
                PubliclyExposedStringsProvider = this.PubliclyExposedStringsProvider, Metadata = pageinfo
            }));
        }
Ejemplo n.º 6
0
        public IActionResult Faq()
        {
            // If configured to redirect to static (most likely prod)
            if (ShouldRedirectToStaticPage)
            {
                Task.Run(() => Logger.LogWarning(new EventId(1, "Request for non-root received." + this.HttpContext.Request.Path.Value), "Request for root received."));
                return(this.RedirectPermanent("https://www.cascadianaerialrobotics.com"));
            }

            var pageinfo = new PageMetadataModel
            {
                Page        = "Frequently asked questions | Cascadian Aerial Robotics LLC",
                Description = "The questions some of our customers or potential customers often have."
            };

            return(View("Faq", new CommonComponentModel {
                PubliclyExposedStringsProvider = this.PubliclyExposedStringsProvider, Metadata = pageinfo
            }));
        }