diff --git a/docs/config.md b/docs/config.md index b4edc7c..7a8acf9 100644 --- a/docs/config.md +++ b/docs/config.md @@ -25,14 +25,13 @@ There are also many *optional* config parameters such as: * `:charset` => to set HTML attributes for international characters, default: "UTF-8" * `:feeds` => to generate RSS and Atom feeds for certain tagged content * `:excerpt-sep` => to set the separator for excerpt in content, default: `` -* `:index-ext` => The extension for the index, default "html" for index.html * `:lang` => to set HTML attributes indicating the site language, default: "en" * `:license` => to override the displayed content license, the default is CC-BY-SA -* `:name-fn` => to modify URL strings after they are generated, default: `'identity` * `:page-ext` => to set the suffix of generated files, default: "html". "" for no extension * `:plugins` => to configure and enable coleslaw's [various plugins][plugin-use] * `:separator` => to set the separator for content metadata, default: ";;;;;" * `:sitenav` => to provide relevant links and ease navigation * `:staging-dir` => for Coleslaw to do intermediate work, default: "/tmp/coleslaw" +* `:title-fn` => to modify document slugs after they are generated, default: `'identity` [plugin-use]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-use.md diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index bdaafd6..57113c1 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -37,14 +37,13 @@ (when (probe-file dir) (if (uiop:os-windows-p) (run-program "(robocopy ~a ~a /MIR /IS) ^& IF %ERRORLEVEL% LEQ 1 exit 0" dir (path:basename dir)) - (run-program "rsync --delete -raz ~a ." dir)) - ))) + (run-program "rsync --delete -raz ~a ." dir))))) (do-subclasses (ctype content) (publish ctype)) (do-subclasses (itype index) (publish itype)) - (update-symlink (format nil "index.~A" (index-ext *config*)) - (format nil "1~A" (page-ext *config*))))) + (let ((recent-posts (first (find-all 'numeric-index)))) + (update-symlink "index.html" (page-url recent-posts))))) (defgeneric deploy (staging) (:documentation "Deploy the STAGING build to the directory specified in the config.") diff --git a/src/config.lisp b/src/config.lisp index 92a1164..1847611 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -10,7 +10,7 @@ (name-fn :initarg :name-fn :reader name-fn) (lang :initarg :lang :reader lang) (license :initarg :license :reader license) - (page-ext :initarg :page-ext :reader page-ext-intolerant) + (page-ext :initarg :page-ext :reader page-ext) (plugins :initarg :plugins :reader plugins) (repo :initarg :repo :accessor repo-dir) (routing :initarg :routing :reader routing) @@ -18,8 +18,7 @@ (sitenav :initarg :sitenav :reader sitenav) (staging-dir :initarg :staging-dir :reader staging-dir) (theme :initarg :theme :reader theme) - (title :initarg :title :reader title) - (index-ext :initarg :index-ext :reader index-ext)) + (title :initarg :title :reader title)) (:default-initargs :feeds nil :license nil @@ -29,17 +28,10 @@ :name-fn 'identity :charset "UTF-8" :lang "en" - :page-ext #1="html" + :page-ext "html" :separator ";;;;;" - :staging-dir "/tmp/coleslaw" - :index-ext #1#)) + :staging-dir "/tmp/coleslaw")) -(defun page-ext (config) - "Get page extension, and allow for an extensionless system." - (let ((ext (page-ext-intolerant config))) - (if (string= ext "") - "" - (concatenate 'string "." ext)))) (defun dir-slot-reader (config name) "Take CONFIG and NAME, and return a directory pathname for the matching SLOT." (ensure-directory-pathname (slot-value config name))) diff --git a/src/documents.lisp b/src/documents.lisp index e306477..a88aef7 100644 --- a/src/documents.lisp +++ b/src/documents.lisp @@ -42,15 +42,8 @@ is provided, it overrides the route used." (error "No routing method found for: ~A" class-name)) (let* ((result (format nil route unique-id)) (type (or (pathname-type result) (page-ext *config*)))) - (make-pathname :name (funcall (name-fn *config*) - (pathname-name result)) - :type (when (string/= type "") - (if (or (string-equal "index" - (pathname-name result)) - (string-equal "1" - (pathname-name result))) - (index-ext *config*) - type)) + (make-pathname :name (funcall (name-fn *config*) (pathname-name result)) + :type type :defaults result)))) (defun get-route (doc-type)