;; content-on-sx — SEO-complete HTML page.
;;
;; content/page-full extends content/page with a lang attribute and a
;; <meta name="description"> drawn from the document excerpt (plain text,
;; truncated). Composes the page, metadata and text layers.
;;
;; Requires (loaded by harness): page.sx (ct-html-escape, content/page-title),
;; text.sx (content/excerpt), render.sx (asHTML).

(define CONTENT-EXCERPT-LEN 160)

(define
  content/page-full
  (fn
    (doc)
    (str
      "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><title>"
      (ct-html-escape (content/page-title doc))
      "</title><meta name=\"description\" content=\""
      (ct-html-escape (content/excerpt doc CONTENT-EXCERPT-LEN))
      "\"></head><body>"
      (asHTML doc)
      "</body></html>")))
