예제 #1
0
        private static void AddPageMetadata(PageHandlerExecutingContext context)
        {
            var seoOptions = (SeoOptions)context.HttpContext.RequestServices.GetRequiredService(typeof(SeoOptions));

            var pageMetadata = new PageMetadata(null, seoOptions.MetaDescription, seoOptions.MetaKeywords);

            var model = (PageModel)context.HandlerInstance;

            model.ViewData["PageMetadata"] = pageMetadata;
        }
 public PassumpsicMillPhotosModel()
 {
     Metadata = new PageMetadata
     {
         Title       = "Passumpsic Mill Photos",
         Description = "A collection of photographs of the original and rebuilt mills in Passumpsic",
         PublishDate = new DateTime(2018, 12, 16),
         Tags        = new[] { TagValues.Places.Passumpsic }
     };
 }
예제 #3
0
        public async Task SaveMetadataAsync(string path, PageMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            string metadataPath = GetMetadataFilePath(path);
            await File.WriteAllTextAsync(metadataPath, JsonConvert.SerializeObject(metadata));
        }
예제 #4
0
 public VhsPassumpsicPhotosModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Vermont Historical Society Photos",
         Description  = "In 2018, the Vermont Historical Society acquired several cabinet card photographs from a descendant of Francis \"Frank\" Mason.",
         PublishDate  = new DateTime(2021, 1, 18),
         PreviewImage = "pages/VhsPassumpsicPhotos/vhspassumpsicphotos-preview.jpg"
     };
 }
예제 #5
0
        private void ShiftPageBackward(PageMetadata pageMetadata, int delta)
        {
            if (delta > pageMetadata.PageStartIndex)
            {
                delta = pageMetadata.PageStartIndex;
            }

            pageMetadata.PageStartIndex -= delta;
            pageMetadata.PageEndIndex   -= delta;
        }
예제 #6
0
        private void ShiftPageForward(PageMetadata pageMetadata, int delta, int collectionCount)
        {
            if (delta > (collectionCount - pageMetadata.PageEndIndex - 1))
            {
                delta = collectionCount - pageMetadata.PageEndIndex - 1;
            }

            pageMetadata.PageStartIndex += delta;
            pageMetadata.PageEndIndex   += delta;
        }
예제 #7
0
        public void PageNumberTest()
        {
            var       target   = new PageMetadata();
            const int expected = 5;

            target.PageNumber = expected;
            int actual = target.PageNumber;

            Assert.AreEqual(expected, actual);
        }
예제 #8
0
 public ElmoreAndCynthiaFamilyPortraitModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Elmore and Cynthia Ide Family Portrait",
         Description  = "A family portrait of Elmore and Cynthia Ide circa 1895.",
         PublishDate  = new DateTime(2019, 1, 12),
         PreviewImage = "pages/ElmoreAndCynthiaFamilyPortrait/e-t-ide-family-portrait-preview.jpg",
         Tags         = new[] { TagValues.System.Photos, TagValues.People.ElmoreIde, TagValues.People.CynthiaIde },
     };
 }
예제 #9
0
 public IndexModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Letters From Florida",
         Description  = "A collection of letters written by Horace Ide to the editor of the Caledonian giving colorful descriptions of his trips to Florida.",
         PreviewQuote = "The woman had on an old, dirty calico dress, open in front; shoes, but no stockings, smoked a pipe, and could beat any Yankee expectorating at a mark. They had a little horse and cart, and a few kettles, etc. Something like the following conversation ensued...",
         PublishDate  = new DateTime(2021, 1, 18),
         Tags         = new[] { TagValues.People.HoraceIde }
     };
 }
예제 #10
0
 public AdamsFelchTaylorIdeModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "William Adams, Henry Felch, John Taylor, Nicholas Ide",
         Description  = "Short biographical and genealogical sketches of the Adams, Felch, Taylor and Ide families.",
         PublishDate  = new DateTime(2021, 1, 19),
         PreviewQuote = "Just a few facts, which we may be glad to remember...",
         Citation     = new Citation(CitationType.Pdf, @"/pages/AdamsFelchTaylorIde/William Adams Henry Felch John Taylor Nicholas Ide.pdf")
     };
 }
예제 #11
0
 public IdeCompanyMarks150YearsHereModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Ide Company Marks 150 Years Here",
         PublishDate  = new DateTime(2021, 3, 6),
         Description  = "An article from the Caledonian-Record on December 21, 1963 on the occasion of the 150th anniversary of E. T. & H. K. Ide. This edition is not available online, fortunately I have five yellowed copies to choose from.",
         PreviewQuote = "A century and a half, four buildings an six generations have contributed to the success of E. T. & H. K. Ide, Inc.",
         Tags         = new[] { TagValues.Places.StJohnsbury, TagValues.People.RichardIde, TagValues.People.TimIde }
     };
 }
예제 #12
0
 public LargeFire1883Model()
 {
     Metadata = new PageMetadata
     {
         Title        = "Large Fire",
         Description  = "A newspaper article describing the fire that consumed the original Passumpsic mill in 1883.",
         PublishDate  = new DateTime(2018, 12, 21),
         PreviewQuote = "The dam was placed there by the one who put rocks into the earth, and gave 23 foot head before it was raised by the hand of man.",
         Tags         = new[] { TagValues.Places.Passumpsic }
     };
 }
 public RichardIdeWorldWar2PhotosModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Richard Ide World War II Photos",
         Description  = "A collection of snapshots taken by Richard Ide during World War II service. Most and maybe all these photos were taken in Bremen.",
         PublishDate  = new DateTime(2019, 1, 12),
         PreviewImage = "pages/RichardIdeWorldWar2/Richard Ide WW2 preview.jpg",
         Tags         = new[] { TagValues.System.Photos, TagValues.People.RichardIde }
     };
 }
예제 #14
0
        public void HasMorePagesTest_ExpectTrue()
        {
            var target = new PageMetadata();

            target.Total      = 100;
            target.PageSize   = 10;
            target.PageNumber = 2;
            bool actual = target.HasMorePages();

            Assert.AreEqual(true, actual);
        }
예제 #15
0
 public LightingTheVillageModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Lighting the Village",
         Description  = "This post describes the electrification of St. Johnsbury streets in 1889, and a proposal by E. T. & H. K. Ide to install and power the lights from the water power in Passumpsic.",
         PublishDate  = new DateTime(2019, 1, 4),
         PreviewQuote = "The Ides have owned a valuable water power at Passumpsic for the last 75 years or more. The present firm have owned it for 22 years.",
         Tags         = new[] { TagValues.People.ElmoreIde, TagValues.Places.Passumpsic, TagValues.Places.StJohnsbury }
     };
 }
예제 #16
0
 public MyGrandfatherModel()
 {
     Metadata = new PageMetadata
     {
         Title       = "My Grandfather",
         Description = "The author of this biographical sketch of E. T. Ide, possibly a school project, is unknown but it may be Katherine Ide Sprague. Katherine was the daughter of Fanny Knights and Oliver Mitchell Wentworth Sprague. She was born in Tokyo, Japan, and lived in Cambridge, Massachusetts as a girl.",
         PublishDate = new DateTime(2018, 12, 17),
         Tags        = new[] { TagValues.People.ElmoreIde },
         Citation    = new Citation(CitationType.Pdf, @"/content/MyGrandfather/My-Grandfather-A-Biographical-Sketch.pdf")
     };
 }
 public RobRoyAndTheBloodhoundsModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Rob Roy and the Bloodhounds",
         Description  = "Rambling reminisces about growing up in St. Johnsbury written by Angus Brooks in 1985.",
         PreviewQuote = "The following pages involve a number of people but specifically four boys [Angus Brooks, Dick Ide, Bill Ricker, and Bill Sprague] in St. Johnsbury, Vermont, during the 1920-1940 days through grade school, the Academy and later years.",
         Citation     = new Citation(CitationType.Pdf, "pages/RobRoyAndTheBloodhounds/Rob Roy and the Bloodhounds.pdf"),
         PublishDate  = new DateTime(2021, 1, 31)
     };
 }
예제 #18
0
        public void HasMorePagesTest_ExpectFalse_PagesEnd()
        {
            var target = new PageMetadata();

            target.Total      = 100;
            target.PageSize   = 10;
            target.PageNumber = 11;
            bool actual = target.HasMorePages();

            Assert.AreEqual(false, actual);
        }
 public RandallArmorPhotosModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Randall Armor Photographs",
         Description  = "A series of photographs of the St. Johnsbury mill taken by Randall Armor on New Year's Eve 2010.",
         PublishDate  = new DateTime(2018, 12, 15),
         PreviewImage = "pages/RandallArmorPhotos/armor_101231-preview.jpg",
         Tags         = new[] { TagValues.System.Photos, TagValues.Places.StJohnsbury },
         Citation     = new Citation(CitationType.Website, @"http://www.armorfoto.com", "Photographs courtesy of Randall Armor &copy,2013")
     };
 }
 public InMemoryOfCompanionHoraceKnightIdeModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "In Memory Of Companion Horace Knight Ide",
         Description  = "A memorial to H. K. Ide published by the Military Order of the Loyal Legion of the United States in 1897.",
         PublishDate  = new DateTime(2018, 12, 17),
         PreviewQuote = "He was nearly four years in the service, was twice wounded, was twice a prisoner of war, and participated&mdash,it is believed&mdash,in forty-two battles and skirmishes.",
         Tags         = new[] { TagValues.People.HoraceIde },
         Citation     = new Citation(CitationType.Pdf, @"/pages/InMemoryOfCompanionHoraceKnightIde/MOLLUS-Circular-No.-3-Series-of-1897.pdf")
     };
 }
 public DisastrousFireAtPassumpsic1883Model()
 {
     Metadata = new PageMetadata
     {
         Title        = "Disastrous Fire at Passumpsic",
         Description  = "The St. Johnsbury Caledonian's account of the 1883 fire that destroyed the original Passumpsic mill.",
         PublishDate  = new DateTime(2019, 1, 4),
         PreviewQuote = "Jacob Ide, the father of the owners of the mill, and the owner before them, was present at the fire and worked hard at saving the property. He came to Passumpsic seventy years ago, and his father before him was the miller at this same mill.",
         Citation     = new Citation(CitationType.Newspaper, "https://chroniclingamerica.loc.gov/lccn/sn84023253/1883-10-12/ed-1/seq-3/", "St. Johnsbury Caledonian, October 12, 1883"),
         Tags         = new string[] { TagValues.People.ElmoreIde, TagValues.Places.Passumpsic }
     };
 }
예제 #22
0
파일: Pager.cs 프로젝트: radtek/documentor
        public async Task <PageContext> GetPageContextAsync(string virtualPath)
        {
            PagePath pagePath = GetPagePath(virtualPath);

            if (pagePath == null)
            {
                throw new AppException("Page not found");
            }
            PageMetadata pageMetadata = await GetPageMetadataAsync(pagePath);

            return(new PageContext(pagePath, pageMetadata));
        }
        public PageMetadata Get(string id)
        {
            PageMetadata page = PageRepository.Get(id);

            if (page != null)
            {
                return(page);
            }

            // Page doesn't exist, find it by the facebook Id.
            return(GetPage(id));
        }
        public void GetContentComponent_NonComponentField_ReturnsNull()
        {
            var page = TreeNode.New <Page>().With(node =>
            {
                node.DocumentName = "Fake page";
            });

            // `page.Metadata` uses the extension method we are testing
            PageMetadata actual = page.Metadata;

            Assert.That(actual, Is.Null);
        }
 public ToFatherAndMotherModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "To Father and Mother from Their Girls",
         Description  = "A 50th anniversary gift from the daughters of Elmore and Cynthia Ide, Katherine, Mary Ellen and Fanny. Written by Katherine, lettered by Mary Ellen, and illustrated by Fanny Ide. Katherine married George Gray, Fanny married Oliver Sprague, and Mary Ellen lived at home.",
         PublishDate  = new DateTime(2019, 1, 12),
         PreviewQuote = "Jacob married Ladoska Knights who was called the prettiest girl in Waterford.",
         PreviewImage = "pages/ToFatherAndMother/to-father-and-mother-009.jpg",
         Citation     = new Citation(CitationType.Pdf, @"/pages/ToFatherAndMother/To Father And Mother.pdf"),
         Tags         = new[] { TagValues.System.Featured, TagValues.People.ElmoreIde, TagValues.People.CynthiaIde }
     };
 }
        public void Deserialize_NullOrEmptyXml_ReturnsNull(string componentXml)
        {
            var deserializer = new PageTypeComponentDeserializer();

            TreeNode     actualUntyped = deserializer.Deserialize(PageMetadata.CLASS_NAME, componentXml);
            PageMetadata actualTyped   = deserializer.Deserialize <PageMetadata>(componentXml);

            Assert.Multiple(() =>
            {
                Assert.That(actualUntyped, Is.Null);
                Assert.That(actualTyped, Is.Null);
            });
        }
예제 #27
0
        public IEnumerable <ScrapedPage> Scrape(PageMetadata[] pages, DateTime start)
        {
            Console.WriteLine($"Started scraping {pages.Length} pages");

            for (int i = 0; i < pages.Length; i++)
            {
                PageMetadata page = pages[i];
                Console.WriteLine($"{i + 1}/{pages.Length}: {page.Name}");

                yield return(Scrape(page, true, start));
            }

            Console.WriteLine($"Done scraping {pages.Length} pages");
        }
예제 #28
0
 public IdeMillersOfStJohnsburyBeganIn1813Model()
 {
     Metadata = new PageMetadata
     {
         Title        = "Ide Millers of St. Johnsbury Began in 1813; Now Run by Fifth Generation",
         PublishDate  = new DateTime(2019, 12, 15),
         PreviewQuote = "This is the record which surpasses all other companies under same-family management in Vermont, and perhaps in the country.",
         Description  = "A 1963 Burlington Free Press article on the occasion of the 150th anniversary of the company.",
         Citation     = new Citation(CitationType.Newspaper,
                                     null, //https://vsara.newspapers.com/image/198974613,
                                     "Burlington Free Press", "April 15, 1963"),
         Tags = new[] { TagValues.Places.Passumpsic, TagValues.Places.StJohnsbury, TagValues.People.RichardIde }
     };
 }
 public PassumpsicRiverMillEnds152YearCareerModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "Passumpsic River Mill Ends 152-Year Career",
         Description  = "Describes the closing of the Passumpsic branch office in 1965.",
         PublishDate  = new DateTime(2019, 12, 14),
         PreviewQuote = "Last Saturday the firm closed its doors on the banks of the Passumpsic River where it had been a grain supplier and miller for area residents.",
         Citation     = new Citation(CitationType.Newspaper,
                                     null, //"https://vsara.newspapers.com/image/199368941", //link requires sign-in
                                     "Burlington Free Press",
                                     "April 1, 1965"),
         Tags = new[] { TagValues.Places.Passumpsic }
     };
 }
예제 #30
0
 public TheWharfModel()
 {
     Metadata = new PageMetadata
     {
         Title        = "The Wharf",
         Description  = "Article about the development of Bay Street in St. Johnsbury.",
         PublishDate  = new DateTime(2019, 12, 21),
         PreviewQuote = "A few years ago it was an eyesore, a swamp, an outlet for a number of sewers, a dumping place for rubbish and a dwelling place for bull-frogs.",
         Citation     = new Citation(CitationType.Newspaper,
                                     "/pages/TheWharf/St_Johnsbury_Republican_Wed__Mar_6__1901_.jpg",
                                     "St. Johnsbury Republican",
                                     "March 6, 1901"),
         Tags = new[] { TagValues.Places.StJohnsbury, TagValues.People.ElmoreIde }
     };
 }