Copied to clipboard

Flag this post as spam?

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

  • vaibhav 119 posts 139 karma points
    Mar 14, 2011 @ 08:46

    template for news

    Hello all

    I want to make 1 templates which will show news written by me ....

    If i add any new news then it should be shown along with old news ....

    ie. new news should be shown 1st & then old news should be shown 2nd....

    I am not understanding that how to make this thing as i am quite new to umbraco ...

    So please help me in doing this .....

  • Jan Skovgaard 11264 posts 23594 karma points MVP 9x admin c-trib
    Mar 16, 2011 @ 19:26
    Jan Skovgaard

    Hi Vaibhav

    To do this you could create a specific document type called "news". When you create and name the document type there is i checkbox that asks if you want to create a template for the document type on creation. Make sure this checkbox is checked.

    When you have setup the document type for news as you would like it to be, you can then go to the "Template" folder where you can see the news template has been created.

    If you create some news nodes/items in the properties tab you can see that the "news" template has automatically been assigned for the node. So every time you create a news node it's been associated with the proper template.

    The news should be created under a document type called "News items" for instance and have it's own template assigned. It is this template that you need to insert for instance a XSLT macro that lists all the news where the latest news is shown first.

    The XSLT for this could for instance look like this

    <xsl:for-each select="$currentPage/News[@isDoc]">

    <li><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="title" /></a></li>


    Please notice that the above requires that you name your document type for a news item "News" and that it has a property called "title", which would generate a link to the news item.

    I hope this makes sense to you.

    Otherwise I think you could maybe benefit from installing the Creative Website Starter package, which is ideal to study when you're starting out with Umbraco since many of the mentioned concepts above are in use in this package.

    Have fun and please don't hesitate to ask if you're in doubt about anything.


  • praveen 113 posts 164 karma points
    Apr 26, 2018 @ 21:06
Please Sign in or register to post replies

Write your reply to: