package main
import (
"bytes"
"fmt"
"html/template"
"net/http"
"os"
"path"
"path/filepath"
"strings"
)
// The default layout replicates the original hand-written site shell
// (table-based two-column layout with sidebar and footer). A file named
// layout.html in the content root overrides it; it must keep using the
// {{.FullTitle}}, {{.Root}} and {{.Content}} actions.
const defaultLayout = `
blocks. The
// date doubles as a link to the post's own page.
func renderEntry(p *Post, root string) string {
var b strings.Builder
fmt.Fprintf(&b, "\n\t\t
\n", p.ID)
if p.Title != "" {
fmt.Fprintf(&b, "\t\t\t
%s
\n", p.Title)
}
fmt.Fprintf(&b, "\t\t\t
%s
\n", root, p.Name, p.DateStr)
if p.HasMore {
b.WriteString(string(p.Excerpt))
b.WriteString("\n")
fmt.Fprintf(&b, "\t\t\t
>>> More
\n", root, p.Name)
} else {
b.WriteString(string(p.Excerpt))
b.WriteString("\n")
}
b.WriteString("\t\t
")
return b.String()
}
func (s *Server) renderNotFound(w http.ResponseWriter, r *http.Request) {
s.render(w, r, http.StatusNotFound, "Not Found",
"
Page Not Found
\n\t\t
The requested page was not found.
")
}