From 2f5472519016b3092dea07d6f041b1cb74c3cd13 Mon Sep 17 00:00:00 2001
From: Adam Spragg <adam@spra.gg>
Date: Tue, 19 Jun 2018 16:35:15 +0100
Subject: Output the page head/header/footer with PHP

Allows putting all the repeated stuff in one place (DRY!), so that if it
needs changing it only needs to change once.

Start the name of the included file with "@", and disallow the retrieval
of files beginning with "@" (returning 404) so that it can't be
downloaded, because it won't output anything meaningful.

Why "@"? Because it's about the only ASCII punctuation character that
doesn't mean anything special to most shells (bash), or programs, and is
therefore easy to use as a filename on the command line. I almost went
with "+", but it turns out that nvim treats arguments beginning with "+"
as options. So "@" it is.
---
 rawdog/page.template | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

(limited to 'rawdog/page.template')

diff --git a/rawdog/page.template b/rawdog/page.template
index 4c0528b..050f719 100644
--- a/rawdog/page.template
+++ b/rawdog/page.template
@@ -1,23 +1,13 @@
-<!DOCTYPE html>
+<?php include '@include.php'; ?><!DOCTYPE html>
 <html lang="en">
 	<head>
-		<title>Blog</title>
-		<link rel="stylesheet" href="/style/main.css" type="text/css" />
+		<?php echo indent(site_head('Blog - Spragg Software Services Ltd.'), 2); ?>
 		<meta name="robots" content="noindex,nofollow,noarchive">
 		__refresh__
 	</head>
 	<body>
 		<header>
-			<h1>Blog</h1>
-			<nav>
-				<ul>
-					<li><a href="/">Home</a></li>
-					<li><a href="/projects">Projects</a></li>
-					<li class="selected"><a href="/blog">Blog</a></li>
-					<li><a href="/privacy">Privacy</a></li>
-					<li><a href="/contact">Contact</a></li>
-				</ul>
-			</nav>
+			<?php echo indent(site_header('Blog'), 3); ?>
 		</header>
 		<main>
 			<section class="items">__items__</section>
@@ -29,6 +19,7 @@
 		<footer>
 			<p id="aboutrawdog">Generated by <a href="http://offog.org/code/rawdog.html">rawdog</a> version
 				__version__</p>
+			<?php echo indent(site_footer(), 3); ?>
 		</footer>
 	</body>
 </html>
-- 
cgit v1.2.1