Back to Notenik Docs


Intro to Website Creation using Notenik

6. Adding a blog ↑

6.12. Review the page template

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

This template will create a web page for each note in the pages collection.

Here’s what it should look like.

<?copycss?>
<?nextrec?>
<?output "../../web/=$title&f$=.html"?>
<!doctype html>
<html>
  <head>
	<meta charset="utf-8">
	<title>=$header$=</title>
	<link rel="stylesheet" href="css/styles.css">
  </head>
  <body>
	<header>
<?clearglobals?>
<?set =$title&f$=-aria-current = page ?>
<?include "../includes-gen/nav-bar.html" ?>
	  <h1>=$header$=</h1>
	</header>
	<main>
<?if "=$Title$=" eq "Blog" ?>
<?include "../includes-gen/blog.html" ?>
<?endif?>
	  =$body&fo$=
	</main>
<?copyimages?>
	<footer>
	  <p>Made with ❤️ and ☕️ by Herb Bowie.</p>
	</footer>
  </body>
</html>
<?loop?>

Most of this should look pretty familiar, as we’ve seen many of these lines in prior versions of the page template.

But here we’ve introduced something new.

<?if "=$Title$=" eq "Blog" ?>
<?include "../includes-gen/blog.html" ?>
<?endif?>

Do you see what we’re doing? If this is the blog page, then we’re pulling in the blog include we generated earlier, before we include the body text.

So now, perhaps, we can see what we need to do next.


Next: 6.13. Create the blog home