How to publish new from umbraco blog to umbraco web site?

414 Views Asked by At

Hi i have a web site on umbraco 4 CMS.Also i want to install a blog plugin.

Is there possible pull news from blog into my site.

Example i want to publish news/post everyday from blog and create link to blog page from my web site.

Preview :

web site

thx for ur help

1

There are 1 best solutions below

0
On

Something like this should work if you are using Blog4Umbraco. It requires that you have the source as a ContentPicker parameter and the maxItems as a number. It does some things like format the date for sorting properly and checking for posts in the past (in case they are scheduled).

<xsl:param name="currentPage"/>

<xsl:variable name="documentTypeAlias" select="string('BlogPost')"/>
<xsl:variable name="source" select="/macro/source"/>
<xsl:variable name="maxItems" select="/macro/maxItems" />


<xsl:template match="/">

  <xsl:variable name="currPosts" select="umbraco.library:GetXmlNodeById($source)//BlogPost [@isDoc and umbraco.library:DateDiff(@createDate, umbraco.library:CurrentDate(), 'm') &lt; 0]"/>


  <xsl:for-each select="$currPosts">
    <xsl:sort select="umbraco.library:FormatDateTime(@createDate, 'yyyyMMdd')" data-type="number" order="descending" />
    <xsl:if test="position() &lt;= $maxItems">
      <div>

        <h4><xsl:value-of select="@nodeName"/></h4>
        <span class="homeBlogDate"><xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'M.dd.yy')"/></span>
        <p>
          <xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(bodyText), 140, ' ')" disable-output-escaping="yes"/>...
        </p>
        <a href="{umbraco.library:NiceUrl(@id)}" class="postReadMore">
          read more &gt;
        </a>
      </div>
    </xsl:if>
  </xsl:for-each>



</xsl:template>