Example #1
0
        public static HttpResponse Archive(HttpRequest request)
        {
            var render = Template.FromFile("templates/archive.html");
            var articles =
                 from article in Article.ArticlesByFilename.Values
                 orderby article.PublishDate descending
                 select article;

            var context = new ArticleList
            {
                Articles = articles
            };

            return new HttpResponse(render(context));
        }
Example #2
0
        public static HttpResponse RssFeed(HttpRequest request)
        {
            var render = Template.FromFile("templates/rss-feed.xml");

            // Get all articles, order them by date
            var articles =
                 from article in Article.ArticlesByFilename.Values
                 orderby article.PublishDate descending
                 select article;

            var context = new ArticleList
            {
                Articles = articles
            };

            return new HttpResponse(render(context), contentType: "application/rss+xml");
        }
Example #3
0
        public static HttpResponse Frontpage(HttpRequest request)
        {
            var render = Template.FromFile("templates/frontpage.html");

            // Get the 5 latest articles
            var latestArticles =
                (from article in Article.ArticlesByFilename.Values
                 orderby article.PublishDate descending
                 select article)
                .Take(5);

            var context = new ArticleList
            {
                Articles = latestArticles
            };

            return new HttpResponse(render(context));
        }