I decided to change things up a little yesterday, and made a few tweaks to get my Ephemera section to display the last 5 entries, rather than the default last months entries. (My ephemera section is the default Symphony Tumblelog, renamed.) And as usual, I couldn't have done it without the help of the great people over at overture21.com.
Step 1: Change the Data Source
The first step in this change is to get the Data Source to get the last 5 entries, rather than the default last month's entries. To do that, go to Blueprints -> Controllers -> Ephemera (Tumblelog if you're on the default install). Change the Format Style to Entry List, and the Included Elements to include date and log_entry. Under limit options, click on the months input box, press escape, and enter 5 in the records box.
Step 2: Change the home page to
The next step is to change the homepage template to call "ephemera/entry" rather than "ephemera/year/month/day". Just replace the value.
Step 3: Change the Ephemera XSL
We've changed the way the template is called, so there's major changes here as well. For reference, here's the old template.
<xsl:template match="tumblelog/year/month/day">
<div class="ephemera listing">
<div class="date">
<xsl:call-template name="get-date">
<xsl:with-param name="year" select="../../@value"/>
<xsl:with-param name="month" select="../@value"/>
<xsl:with-param name="day" select="@value"/>
<xsl:with-param name="format" select=" 'short' "/>
</xsl:call-template>
</div>
<xsl:apply-templates select="entry"/>
</div>
</xsl:template>
<xsl:template match="tumblelog/year/month/day/entry">
<div class="entry">
<xsl:copy-of select="fields/log-entry/*"/>
</div>
</xsl:template>
First, I renamed the template, then merged the second template call into the first, and third changed the way the date was displayed. Here's the final result.
<xsl:template match="ephemera/entry">
<div class="ephemera listing">
<div class="date">
<xsl:call-template name="get-month">
<xsl:with-param name="date" select="date"/>
<xsl:with-param name="format" select=" 'short' "/>
</xsl:call-template>
<xsl:text> </xsl:text>
<xsl:call-template name="get-day">
<xsl:with-param name="date" select="date"/>
<xsl:with-param name="format" select=" 'short' "/>
</xsl:call-template>
</div>
<div class="entry">
<xsl:copy-of select="fields/log-entry/*"/>
</div>
</div>
</xsl:template>