Documentation > Best Practices and Examples > CMSAPI

Implementing a Blog in CrownPeak

You can use a blog to drive traffic to the most current content on your Website. Blog pages can be updated quickly with product announcements and updates or you can start a dicussion based on a particular topic that you know your customers will benefit from.

Overview


The blog implementation is a ?plug and play? CrownPeak module which consists of several templates that can be used. The blog functionality is very flexible and is devised to be seamlessly integrated into any instance regardless of design.

These templates that support CrownPeak?s blogging platform are configured using the C# API. Standard blog implementations can include a separate workflow, so content can be approved to the site in a less restrictive manner.

You can use the following templates to create a blog:

  • Author Config:content pulled automatically into About Authors page
  • Fields: Author Name, Show/Hide from About Authors Page, Author Title, Author Short Title, Author Company, Author image thumbnail, Author Bio (WYSIWYG)
  • About Authors: pulls Author config
  • Taxonomy: create tag and category assets that can be reused on blog posts
  • Fields: Title, Name, Image
  • Output: stores type and name
  • Blog Post: create blog post, add tags and categories as desired.
  • Fields: Page Label, Title, Sub-Title, Summary, Publish Live Date, Content Option (WYSIWYG with optional Image, Link List, Text List)
  • Blog Index:aggregates blog posts, built by IndexBuilder function
  • Fields: Posts, Post Limit
  • Blog Archive: based on user-created archive folders
  • Fields: Month, Post Limit
  • Right widget include - category, archive, and most recent tabs

Example


You can use an API call to sort blog posts in the archive to make the content easier to locate by date.

                    <div id="archive-tabbed" class="widget">
                    <%
                    StringBuilder archiveOutput = new StringBuilder("");
                    Asset archivesFolder = Asst.Load("/" + asset.AssetPath[0] = "/Blog/Archive/");
                    last = false;
                    AssetParams aFolderParams = new AssetParams();
                    aFolderParams.SortOrder = SortOrderByDescending(AssetPropertyNames.Label);
                    //Out.DebugWriteLine(asset.Label);
                    If (archivesFolder.IsLoaded)
                    {
                    List<Asset> archiveFolders = archivesFolder.GetFolderList(aFolderParams);
                    foreach (Asset archiveFolder in in ArchiveFolders)
                    {
                    aParams = new AssetParams();
                    aParams.SortOrder = SortOrder.OrderByDescending("select_month");
                    List<Asset> archives = archiveFolder.GetFileList(aParams);
                    foreach (Asset archive in archives)
                    {
                    archiveOutput.Append(postWidgetAsset(archive, context, last));
                    archiveOutput.AppendLine("<!--new item-->");
                    }
                    }
                    If (!String.IsNullOrWhiteSpace(archiveOutput.ToString()))
                    {
                    Out.WriteLine(String.Format("<ul>\n{0}\n</ul>/n", archiveOutput.ToString()));
                    }
                    else
                    {
                    Out.WriteLine("<!--no posts to display-->");
                    }
                    }
                    else
                    {
                    Out.WriteLine("<!--no posts to display-folder not loaded-->");
                    }
                    %>
                    </div>
                

Connect with CrownPeak