示例#1
0
        /// <summary>
        /// Writes out the empty pages for the post. Also handles the redirect pages
        /// </summary>
        public void WritePages()
        {
            PageTemplateToolboxContext templateContext = new PageTemplateToolboxContext();

            templateContext.Put("PostId", Id);
            templateContext.Put("CategoryId", CategoryId);
            templateContext.Put("PostName", Name);
            templateContext.Put("Name", Name);
            templateContext.Put("CategoryName", Category.LinkName);
            templateContext.Put("MetaDescription",
                                !string.IsNullOrEmpty(MetaDescription)
                                    ? MetaDescription
                                    : HttpUtility.HtmlEncode(Util.RemoveHtml(PostBody, 255) ?? string.Empty));

            templateContext.Put("MetaKeywords",
                                !string.IsNullOrEmpty(MetaKeywords)
                                    ? MetaKeywords
                                    : TagList);


            string pageName = null;

            if (CategoryController.UnCategorizedId != CategoryId)
            {
                pageName = categories.GetCachedCategory(CategoryId, false).LinkName + "/";
            }

            pageName = "~/" + pageName + Name + "/" + Util.DEFAULT_PAGE;

            PageWriter.Write("post.view", pageName, templateContext);
        }
示例#2
0
        /// <summary>
        ///     Writes empty pages to disk.
        /// </summary>
        public void WritePages()
        {
            PageTemplateToolboxContext templateContext = new PageTemplateToolboxContext();

            templateContext.Put("CategoryId", Id);
            templateContext.Put("CategoryName", LinkName);
            templateContext.Put("MetaDescription",
                                !string.IsNullOrEmpty(MetaDescription)
                                                                        ? MetaDescription
                                                                        : HttpUtility.HtmlEncode(Util.RemoveHtml(Body, 255) ?? string.Empty));

            templateContext.Put("MetaKeywords",
                                !string.IsNullOrEmpty(MetaKeywords)
                                                                        ? MetaKeywords
                                                                        : Name);


            if (!IsUncategorized)
            {
                PageWriter.Write("category.view", "~/" + LinkName + "/" + Util.DEFAULT_PAGE, templateContext);
                PageWriter.Write("categoryrss.view", "~/" + LinkName + "/feed/" + Util.DEFAULT_PAGE, templateContext);
            }

            if (__initialCategoryName != null && __initialCategoryName != LinkName)
            {
                PostCollection pc        = new PostCollection();
                Query          postQuery = Post.CreateQuery();
                postQuery.AndWhere(Post.Columns.CategoryId, Id);
                pc.LoadAndCloseReader(postQuery.ExecuteReader());
                foreach (Post p in pc)
                {
                    p.Save();
                }
            }
        }
示例#3
0
        public static void WritePage(string name)
        {
            PageTemplateToolboxContext templateContext = new PageTemplateToolboxContext();

            templateContext.Put("tag", name);
            templateContext.Put("MetaDescription", "Posts and articles tagged as " + name);
            templateContext.Put("MetaKeywords", name);


            PageWriter.Write("tag.view", "~/tags/" + name + "/" + Util.DEFAULT_PAGE, templateContext);
            PageWriter.Write("tagrss.view", "~/tags/" + name + "/feed/" + Util.DEFAULT_PAGE, templateContext);
        }