Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Johan Roug 97 posts 153 karma points
    Aug 30, 2009 @ 02:38
    Johan Roug
    0

    blog4umbraco

    hi

    I installed blog4umbraco, and it works fine, but I would like that the blogpost could be shown on the frontpage of my website. I have tried all kind of stuff. adding the blogListPost.xslt to my frontpage template etc.. but no data show. I can make categories show, but not the post.. What am I doing wrong??

  • Paul Blair 466 posts 731 karma points
    Aug 30, 2009 @ 05:43
    Paul Blair
    100

    I have done this on my own site. You will need to create a new xslt macro, something like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxml="urn:schemas-microsoft-com:xslt"
        xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

      <xsl:for-each select="$currentPage/ancestor::root//node [@nodeTypeAlias = 'BlogPost']">
        <xsl:sort select="@createDate" order="descending" />
        <xsl:if test="position()=1">
          <h3><xsl:value-of select="@nodeName"/></h3>
          <h4>on <xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'dd MMM yyyy')"/></h4>
          <xsl:value-of select="./data [@alias = 'bodyText']" disable-output-escaping="yes"/>
        </xsl:if>
      </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

  • Johan Roug 97 posts 153 karma points
    Aug 30, 2009 @ 18:17
    Johan Roug
    0

    thanks. I'll take that code for a spin, when I come home

  • Johan Roug 97 posts 153 karma points
    Aug 31, 2009 @ 17:19
    Johan Roug
    0

    It works perfectly thanks

  • Anthony Candaele 1197 posts 2049 karma points
    Feb 17, 2011 @ 14:42
    Anthony Candaele
    0

    Hi Paul,

    I tried to implement your xslt macro on my website, but it is not working. The only difference in my site structure is that the blog node is a child of a homepage node, like this:

    As you can see on the screenshot I have a document type 'dv blog' that is a child of the document type 'dv homepage'.

    So I guess I have to adjust the XPath axis in your code:

    <xsl:for-each select="$currentPage/ancestor::root//node [@nodeTypeAlias = 'BlogPost']">

    But I tried all kinds of combinations like

    <xsl:for-each select="$currentPage/DVBlog//node[@nodeTypeAlias = 'DVBlogPost']">

    but that doesn't work.

    Help would be much appreciated,


    Anthony Candaele
    Belgium

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies