Search code examples
koken

how to make custom templates in Koken


I'm using Koken and would like to customize the template for text entries by putting the date at the top of the entry.

I hacked a call to new Date() into the core template file /admin/templates/text.tmpl.html

<div id="entry-editor">
    <div id="edit-area" data-bind="html: content() || 
        '<p class=\'date\'>' + new Date() + '</p>
         <p class=\'media-row\'><br /></p>'">
    </div>
</div> <!-- close #entry-editor -->

This works fine, but I know the perils of hacking core files.

As of this writing, I don't see an answer on the page linked as "define your own custom template types" on help.koken.me.

Without hacking core files, how can I have Koken add a date to the top of each text entry?


Solution

  • From http://help.koken.me/customer/portal/questions/1080677-how-to-make-custom-templates-in-koken-

    Simply place a <koken:time> tag in the customized theme template.

    For example, in my /storage/themes/<custom-theme-name>/essay.lens file:

    <header>
        <h2>
            <koken:link>{{ essay.title }}</koken:link>
        </h2>
        <p>
            <strong><koken:time show="time" /> <koken:time show="date" /></strong>
        </p>
    </header>