Display blog/blog summary on another page

Hi.
I am trying to display content of the blogpost in another section. Tried using blog macro, but it displays everything: date/image thumbnail , header of blogpost etc. I only need blogpost content/summary.If I am not wrong, “include macro” could not be used here in this case. Tried making new layout for blog, but facing issue in it. And I don’t think even new layout would give me what I need.

Hello nickhil.

You need to write a little script that get the BlogPost object from the other page and display the “content” field. Example: Velocity.

An other tutorial: http://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Scripting/XWikiVelocityTraining/

I hope it helps,

Guillaume

Hi nickhil,

Below is an example to do to list news titles. It works for me, but I do not know if I did it the best way possible, but maybe this will help you. If anyone has an improvement tip, thank you.

{{html wiki="true"}}

<div class="panel expanded"  style="background-color: #f9f7e6; min-height:260px;">
<h1 class="xwikipaneltitle" style="background-color: #f9f7e6;">Last News</h1>
<div class="xwikipanelcontents">

{{include reference="Blog.BlogCode"/}}
{{velocity}}
#getBlogEntriesBaseQuery($query)


{{/velocity}}


<div class="ultnotscol1">

{{velocity}}
#set($recentEntries1 = $services.query.hql("${query} and doc.space = 'Intranet.MyNews' order by publishDate.value desc").setLimit(6).setOffset(0).execute())
#if($recentEntries1.size() > 0)
  (% class="linha" %)
  #foreach($entryDoc in $xwiki.wrapDocs($recentEntries1))
    #getEntryObject($entryDoc $entryObj)
        * [[$!{entryDoc.display('title', 'view', $entryObj).replaceAll('(\[|\]|\||>)', '~~$1')}>>$!{services.model.serialize($entryDoc.documentReference).replaceAll('(\[|\]|\||>)', '~$1')}]]
  #end
#end
{{/velocity}}
</div>

</div>
</div>

{{/html}}