~.town / ~cel

template.html.sh

template.html.sh: template.html

#!/bin/sh

cat <<HTML
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>$TITLE${TITLE:+ // }~cel</title>
    <link rel="stylesheet" type="text/css" href="style.css" />
    <link rel="alternate" type="application/atom+xml" title="~cel @ tilde.town" href="http://tilde.town/~cel/feed.xml" />
    <link rel="icon" type="image/x-icon" href="images/favicon.ico">
HTML
    test -e /dev/fd/3 && sed 's/^/    /' <&3
cat <<HTML
</head>
<body>

HTML
test -n "$PAGE" && cat <<HTML
  <header>
    <a href="/">~.town</a> /
    <a href="./">~cel</a>
${TITLE:+    <h1 class=right>${TITLE}</h1>
}   </header>
HTML
cat <<HTML

  <article>
HTML
cat
if test -z "$NO_COMMENTS"
then
  cat <<HTML
    <section id="comments">
      <h3>Comments</h3>
HTML
  if test -s "${comments_file:="$PAGE.comments.md"}"
  then
    markdown <"$comments_file"
  else
    cat <<HTML
      <p>There are no comments yet.</p>
HTML
  fi
  cat <<HTML
      <p>To post a comment,
        run <code>mail cel+comment -s $PAGE</code> on tilde.town.</p>
    </section>
HTML
fi
cat <<HTML
  </article>

  <footer class="badges">
    <a href="/">
      <img src="http://tilde.town/~imt/img/tilde80x15.png" alt=""/></a>
    <a href="https://creativecommons.org/publicdomain/zero/1.0/">
      <img src="images/cc0.png" alt="CC0"/></a>
    <a href="http://validator.w3.org/check?uri=referer">
      <img src="images/w3c-html5.png" alt="W3C HTML5"/></a>
    <a href="feed.xml">
      <img src="/~imt/img/rssFeed.png" alt="RSS Atom feed"/></a>
HTML
test -n "$SOURCE" && cat <<HTML
    <a href="$SOURCE">
      <img src="images/view-source.png" alt="View page source"/></a>
HTML
cat <<HTML
  </footer>

</body>
</html>
HTML