Commit 8ef92206 authored by Cherie Yang's avatar Cherie Yang

Merge branch 'fix-pathnames' into 'master'

Fix pathnames to use the asd defintion as the root

See merge request !1
parents 5c3d2896 d6f23fb6
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(in-package :cl-site)
(require :asdf)
;; Locations for various files
(defparameter *PAGES-DIR* "content/")
(defparameter *LAYOUT-DIR* "layout/templates/")
(defparameter *OUTPUT-DIR* "output/")
(defparameter *PAGES-DIR* (asdf:system-relative-pathname :cl-site "content/"))
(defparameter *LAYOUT-DIR* (asdf:system-relative-pathname :cl-site "layout/templates/"))
(defparameter *OUTPUT-DIR* (asdf:system-relative-pathname :cl-site "output/"))
(defparameter *PRIVATE-KEYS* '(:slug :content))
(defparameter *PAGES*
......@@ -18,8 +19,11 @@
(defun make-path (prefix page)
(pathname (concatenate 'string
prefix (cdr (assoc :content page)))))
(let ((path (cdr (assoc :content page))))
(if (pathnamep prefix)
(merge-pathnames path prefix)
(pathname (concatenate 'string
prefix path)))))
(defun file-to-string (filepath)
(with-open-file (stream filepath)
......@@ -40,7 +44,6 @@
(mustache:render template-path page-context output-stream))))
(defun make-site ()
(let
((template-path (pathname (concatenate 'string *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*))))
(loop for page in *PAGES*
do (render-page page template-path))))
(let ((template-path (pathname (merge-pathnames *LAYOUT-DIR* *DEFAULT-PAGE-TEMPLATE*))))
(loop for page in *PAGES*
do (render-page page template-path))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment