Forum Discussion

nickyates's avatar
nickyates
Mentor
12 years ago

Linking blog archive dates to a custom blog

Hi,   I have created an entirely custom blog page which works great however i would like to intergrate archives into this.  Currently when i click on an archives date range it links me back to my b...
  • KaelaC's avatar
    12 years ago

    I would also suggest customizing the BlogMessage page instead of the BlogPage.  In the BlogPage you have a component called

     

    <component id="articles"/>

     

    This component is made up of individual article messages.  Each one of those is a BlogMessage.  If you keep "aritcles" in place and change BlogMessage you will get paging, label filters, and archives without having to do any customization.  You can, of course, customize the BlogPage around that "articles" component as much as you like.  Here is an example of what your xml would look like:

     

    BlogPage

    <?xml version="1.0" encoding="UTF-8"?>
    <quilt layout="two-column.main-side" nestable="false">
      <add to="common-header">
        <component id="quilt:Header"/>
      </add>
      <add to="main-content">
        <component id="menu-bar"/>
        <component id="archive-info"/>
        <component id="filtered-by"/>
        <component id="articles"/>
        <component id="paging"/>
      </add>
      <add to="side-content">
        <component id="twitter.widget.stream"/>
        <component id="kudos.widget.messages-leaderboard"/>
        <component id="blogs.widget.bios"/>
        <component id="common.widget.announcement"/>
        <component id="blogs.widget.labels"/>
        <component id="blogs.widget.archives"/>
        <component id="forums.widget.polls"/>
        <component id="kudos.widget.givers-leaderboard"/>
      </add>
    </quilt>

     

    BlogMessage

    <?xml version="1.0" encoding="UTF-8"?>
    <quilt layout="blog-message">
    	<add to="main">
    		<component id="my-custom-blog-article" />
    	</add>
    	<add to="footer-left">
    		<component id="actions" />
    		<component id="modbar" />
    	</add>
    	<add to="footer-right">
    		<component id="kudos" />
    		<component id="bookmarks" />
    	</add>
    </quilt>

     

    The only thing to keep in mind is that BlogMessage is used both on the BlogPage and on the BlogArticlePage.  So when you are writing your custom component you will likely need some code that change the output depeding on the page. For example, in my "my-custom-blog-article" component I would have:

     

    <#if page.name =="BlogPage">
    show custom stuff on the blog page (teasers and things)
    <#else>
    <#-- show the normal stuff -->
    		<@component id="message-header" />
    		<@component id="body" />
    		<@component id="message-footer" />
    </#if>