Back to Notenik Docs


Intro to Website Creation using Notenik

6. Adding a blog ↑

6.10. Review the blog template

Let’s review the templates file named chapter 06 - blog template.html.

This will generate an include file to be pulled in later. This is what the template looks like.

<?output "../includes-gen/blog.html" ?>
<?nextrec?>
      <article>
        <h2>
          <a href="posts/=$date&yyyy-MM-dd$=-=$title&f$=.html">
            =$title$=
          </a>
        </h2>
        <p><time datetime="=$date&yyyy-MM-dd$=">=$date&MMM d, yyyy$=</time></p>
        =$teaser&o$=
    </article>
<?loop?>

You should be able to see that this looks very much like Blake’s index page, except that we’re using variables rather than actual literal values.

You may notice we’re using the merge variable formatting string of &yyyy-MM-dd$ to format the date field into a year-month-day format, and then using a different string, &MMM d, yyyy, to format it into a more readable format, with the month first, and spelled out using a 3-letter abbreviation.

You can also see that we’re displaying the Teaser field here, to give readers some idea of what each post is about, and are using the &o merge variable modifier, which will apply Markdown parsing to the field. (This means that we can use the Markdown syntax in the Teaser field, as well as in the Body field!)


Next: 6.11. Review the post template