Only Show Blogs on the Homepage in Community Server

Posted Monday, January 28, 2008 12:36 PM by Kevin

One of the DNM guys asked this morning if we could limit the "What's New" section on the homepage to display only blog posts (no forum posts, recent photos, files, etc).  I figure there is probably a way to filter the data being bound to the IndexPostList control on the homepage, but a simpler way for me was to copy/paste over the existing WeblogPostList control from the Blogs page.  After applying a little CSS magic, I came up with this:

<CSBlog:WeblogPostList runat="Server">

    <QueryOverrides PagerID="Pager" IsAggregate="true" />

    <HeaderTemplate>

        <p />

        <h2 class="CommonTitle"><CSControl:ResourceControl ResourceName="default_homepage_recentposts" runat="server" /></h2>

        <div class="CommonContent">

        <ul class="CommonSearchResultList">

    </HeaderTemplate>

    <ItemTemplate>

        <CSControl:ConditionalContent runat="server">

            <ContentConditions Operator="Not"><CSBlog:WeblogPostPropertyValueComparison runat="server" ComparisonProperty="IsExternal" Operator="IsSetOrTrue" /></ContentConditions>

            <TrueContentTemplate><li class="BlogPostArea"></TrueContentTemplate>

            <FalseContentTemplate><li class="BlogPostArea External"></FalseContentTemplate>

        </CSControl:ConditionalContent>

            <div class="CommonSearchResultArea Weblog">

                <CSBlog:WeblogPostData Property="Subject" LinkTo="Post" Tag="H4" CssClass="CommonSearchResultName" runat="server" />

                <CSBlog:WeblogPostData Property="Excerpt" Tag="Div" CssClass="CommonSearchResult" runat="server" />

                <div class="CommonSearchResultDetails">

                    <CSBlog:WeblogPostData Property="UserTime" LinkTo="Post" IncludeTimeInDate="true" runat="server" />

                    <CSControl:ResourceControl runat="server" ResourceName="Weblog_Aggregate_By" />

                    <CSBlog:WeblogPostData Property="DisplayName" LinkTo="AuthorUrl" runat="server" />

                    <CSControl:ResourceControl runat="server" ResourceName="To" />

                    <CSBlog:WeblogData Property="Name" LinkTo="HomePage" runat="server" />

                    <CSBlog:WeblogPostTagEditableList runat="server" EditorLinkCssClass="CommonTextButton" EditorCssClass="CommonInlineTagEditor" Tag="Div" />

                </div>

            </div>

        </li>

    </ItemTemplate>

    <FooterTemplate>

        </ul>

    </FooterTemplate>

</CSBlog:WeblogPostList>

I replaced the IndexPostList control in home.aspx with this and removed the code from OnInit that bound data to the post list and that's all there was to it!

Comments

No Comments