Redirected from DekiScript/FAQ/How do I... Simulate a Blog in MindTouch Deki?
0 of 1 found this page helpful

Simple Blog

    Table of contents
    1. 1. Summary:
    2. 2. The Setup:

    Summary:

    Using some simple DekiScript and creative tagging it is possible to simulate a blog in MindTouch Deki. The core idea behind this solution is that the powerful features available to you on the canvas of Deki enable the creation of rich media posts.

    The Setup:

    The setup is very simple. Add a template called Blog to your Deki installation which contains the following format in HTML source view.

    <h1>Blog for {{ site.name }}</h1>
      <div init="var ix = wiki.getsearch{query: 'tag:blogpost', sortby: '-date'} " style="width: 550px;">
        <div foreach="var p in ix" style="margin-bottom: 80px; background-image: url(http://demo.mindtouch.com/@api/deki/files/2619/=h4_bg.gif); background-repeat: repeat-x;">
          <div style="width: 50px; float: left; padding-top: 1px;">
    {{ web.image(uri.build('http://www.gravatar.com/avatar',p.author.emailhash,{s:'50'})) }} </div>
          <div style="margin-left: 60px;"> <span style="color: #6a7983; font-size: 30px;">{{web.link(p.uri, p.title); }}</span><br  /><span style="font-size: 11px; color: #999999;">{{ date.date(p.date); }}&nbsp; last updated by {{ p.author.name }} @ {{ date.time(p.date) }}</span> </div> {{ <br  />
    if (p.namespace == &quot;&quot;) <br  />
    { wiki.page{path: p.unprefixedpath} } <br  />
    else <br  />
    { <br  />
    wiki.page{path: p.namespace .. &quot;:&quot; .. p.unprefixedpath} } <br  />
    }}
          <div style="border: 1px solid #999999; padding: 5px; background: #efefef none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-size: 11px;">
            <ul style="margin: 0px; padding: 0px; overflow: hidden;">
              <li style="margin: 0px; padding: 0px; list-style-type: none; float: left;"><strong>Tags: </strong></li>
              <li style="list-style-type: none; float: left;" foreach="var t in p.tags">{{web.link('/Special:Tags?tag='..t.value,t.value)}}</li>
            </ul>
            <ul style="margin: 10px 0px 0px; padding: 0px; overflow: hidden;">
              <li style="margin: 0px; padding: 0px; list-style-type: none; float: left;"><strong>Viewed: </strong></li>
              <li style="list-style-type: none; float: left;">{{ p.viewcount; }}</li>
            </ul>
          </div>
        </div>
      </div>
      <p> 
    {{ wiki.create{label: &quot;New Blog Post&quot;, path: &quot;community/&quot;, template: &quot;BlogPost&quot;, title: &quot;Please Enter A Title&quot;} }}</p>

       

    Next Use your Blog template on a wiki page

    {{ template( "Blog" ) }}

    Now any page tagged with blogpost will show on the Blog page in date last edited.

    Was this page helpful?
    Tag page
    Viewing 9 of 9 comments: view all
    One problem. When you click on "new blog post" the page created is not assigned the tag "blogpost" so unless you add it the page will not show up as part of the blog.
    Posted 14:01, 4 Sep 2008
    very new at this...(sorry if this is completely dumb)
    Could new posting to the blog be dynamically created as sub pages of the blog?
    Could the “blogpost” tag also be a dynamic construct of the originating blogs name?

    Then the pages would be kept logically placed relative to the blog home page
    And the dynamic tag would allow multiple blogs to exist within the same wiki.

    (and as the mcraven says above the tag needs to be automatically added)

    Posted 16:40, 13 Sep 2008
    Greg101, did you ever get an answer to this?
    Posted 18:30, 26 Feb 2009
    I've posted the code to an alternative template that uses subpages instead of tags--that may help. edited 10:36, 23 Apr 2009
    Posted 07:05, 23 Apr 2009
    Very cool, does anyone know how to RSS/Atom feed the blog entries? When you try to feed off the main blog page you just get the dekiscript. Is there a way to feed off the tag (in this case blogpost)?
    Posted 14:07, 25 Apr 2009
    If you keep all the posts as children of a particular page, you can subscribe to "This page and all subpages" in the Lyons release. If using the "tag:blogpost" method, you could create a search for pages tagged with "blogpost" and subscribe to the results, perhaps, although that's probably not ideal.
    Posted 06:13, 27 Apr 2009
    I may be getting the wrong end of the stick, but I'm not sure these instructions are complete...
    Line 26 of the code seems to invoke a template called 'blogpost' when creating a new blog post. This template isn't referenced anywhere in these instructions. When I created a blank template called 'blogpost' and gave it a tag of 'blogpost' it all started to work fine, which makes sense because line 2 seems to be searching for pages tagged 'blogpost'.
    Even the Alternative Blog template calls a template called 'BlogPost' when creating new blog pages (though the search in the Alternative does not rely on tags, but hierarchy)
    Posted 01:30, 18 Feb 2010
    I added some parts to be able to have different blogs in different locations:
    just call the template with the parameter {{ template("Blog", {location:"Blog"}) }}

    <p>{{ wiki.create{label: &quot;New Blog Post&quot;, path: $location, template: &quot;BlogPost&quot;, title: &quot;Please Enter A Title&quot;} }}</p>
    <div init="var ix = wiki.getsearch('tag:blogpost',_, '-date', 'path:' .. $location .. '/*') " style="width: 550px;">
    <div foreach="var p in ix" style="margin-bottom: 40px; background-image: url(http://demo.mindtouch.com/@api/deki/files/2619/=h4_bg.gif); background-repeat: repeat-x;">
    <div style="margin-left: 0px;"><span style="color: #6a7983; font-size: 18px;">{{web.link(p.uri, p.title); }}</span><br />
    <span style="font-size: 11px; color: #999999;">{{ date.date(p.date); }}&nbsp; last updated by {{ p.author.name }} @ {{ date.time(p.date) }}</span></div>
    {{<br />
    if (p.namespace == &quot;&quot;)<br />
    { wiki.page{path: p.unprefixedpath} }<br />
    else<br />
    {<br />
    wiki.page{path: p.namespace .. &quot;:&quot; .. p.unprefixedpath} }<br />
    }}</div>
    </div>
    Posted 12:31, 8 Mar 2011
    Is there way to modify this code so that new comments are posted at the TOP of the list of comments? I need to have the MOST RECENT comments show up at the top of the list......
    Posted 10:30, 7 Dec 2011
    Viewing 9 of 9 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by