Merge pull request #207 from coleslaw-org/fix-extensionless-routing
Fix routing issues
This commit is contained in:
commit
cc0271b319
4 changed files with 10 additions and 27 deletions
|
@ -25,14 +25,13 @@ There are also many *optional* config parameters such as:
|
||||||
* `:charset` => to set HTML attributes for international characters, default: "UTF-8"
|
* `:charset` => to set HTML attributes for international characters, default: "UTF-8"
|
||||||
* `:feeds` => to generate RSS and Atom feeds for certain tagged content
|
* `:feeds` => to generate RSS and Atom feeds for certain tagged content
|
||||||
* `:excerpt-sep` => to set the separator for excerpt in content, default: `<!--more-->`
|
* `:excerpt-sep` => to set the separator for excerpt in content, default: `<!--more-->`
|
||||||
* `:index-ext` => The extension for the index, default "html" for index.html
|
|
||||||
* `:lang` => to set HTML attributes indicating the site language, default: "en"
|
* `:lang` => to set HTML attributes indicating the site language, default: "en"
|
||||||
* `:license` => to override the displayed content license, the default is CC-BY-SA
|
* `: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
|
* `: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]
|
* `:plugins` => to configure and enable coleslaw's [various plugins][plugin-use]
|
||||||
* `:separator` => to set the separator for content metadata, default: ";;;;;"
|
* `:separator` => to set the separator for content metadata, default: ";;;;;"
|
||||||
* `:sitenav` => to provide relevant links and ease navigation
|
* `:sitenav` => to provide relevant links and ease navigation
|
||||||
* `:staging-dir` => for Coleslaw to do intermediate work, default: "/tmp/coleslaw"
|
* `: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
|
[plugin-use]: https://github.com/redline6561/coleslaw/blob/master/docs/plugin-use.md
|
||||||
|
|
|
@ -37,14 +37,13 @@
|
||||||
(when (probe-file dir)
|
(when (probe-file dir)
|
||||||
(if (uiop:os-windows-p)
|
(if (uiop:os-windows-p)
|
||||||
(run-program "(robocopy ~a ~a /MIR /IS) ^& IF %ERRORLEVEL% LEQ 1 exit 0" dir (path:basename dir))
|
(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)
|
(do-subclasses (ctype content)
|
||||||
(publish ctype))
|
(publish ctype))
|
||||||
(do-subclasses (itype index)
|
(do-subclasses (itype index)
|
||||||
(publish itype))
|
(publish itype))
|
||||||
(update-symlink (format nil "index.~A" (index-ext *config*))
|
(let ((recent-posts (first (find-all 'numeric-index))))
|
||||||
(format nil "1~A" (page-ext *config*)))))
|
(update-symlink "index.html" (page-url recent-posts)))))
|
||||||
|
|
||||||
(defgeneric deploy (staging)
|
(defgeneric deploy (staging)
|
||||||
(:documentation "Deploy the STAGING build to the directory specified in the config.")
|
(:documentation "Deploy the STAGING build to the directory specified in the config.")
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
(name-fn :initarg :name-fn :reader name-fn)
|
(name-fn :initarg :name-fn :reader name-fn)
|
||||||
(lang :initarg :lang :reader lang)
|
(lang :initarg :lang :reader lang)
|
||||||
(license :initarg :license :reader license)
|
(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)
|
(plugins :initarg :plugins :reader plugins)
|
||||||
(repo :initarg :repo :accessor repo-dir)
|
(repo :initarg :repo :accessor repo-dir)
|
||||||
(routing :initarg :routing :reader routing)
|
(routing :initarg :routing :reader routing)
|
||||||
|
@ -18,8 +18,7 @@
|
||||||
(sitenav :initarg :sitenav :reader sitenav)
|
(sitenav :initarg :sitenav :reader sitenav)
|
||||||
(staging-dir :initarg :staging-dir :reader staging-dir)
|
(staging-dir :initarg :staging-dir :reader staging-dir)
|
||||||
(theme :initarg :theme :reader theme)
|
(theme :initarg :theme :reader theme)
|
||||||
(title :initarg :title :reader title)
|
(title :initarg :title :reader title))
|
||||||
(index-ext :initarg :index-ext :reader index-ext))
|
|
||||||
(:default-initargs
|
(:default-initargs
|
||||||
:feeds nil
|
:feeds nil
|
||||||
:license nil
|
:license nil
|
||||||
|
@ -29,17 +28,10 @@
|
||||||
:name-fn 'identity
|
:name-fn 'identity
|
||||||
:charset "UTF-8"
|
:charset "UTF-8"
|
||||||
:lang "en"
|
:lang "en"
|
||||||
:page-ext #1="html"
|
:page-ext "html"
|
||||||
:separator ";;;;;"
|
:separator ";;;;;"
|
||||||
:staging-dir "/tmp/coleslaw"
|
:staging-dir "/tmp/coleslaw"))
|
||||||
:index-ext #1#))
|
|
||||||
|
|
||||||
(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)
|
(defun dir-slot-reader (config name)
|
||||||
"Take CONFIG and NAME, and return a directory pathname for the matching SLOT."
|
"Take CONFIG and NAME, and return a directory pathname for the matching SLOT."
|
||||||
(ensure-directory-pathname (slot-value config name)))
|
(ensure-directory-pathname (slot-value config name)))
|
||||||
|
|
|
@ -42,15 +42,8 @@ is provided, it overrides the route used."
|
||||||
(error "No routing method found for: ~A" class-name))
|
(error "No routing method found for: ~A" class-name))
|
||||||
(let* ((result (format nil route unique-id))
|
(let* ((result (format nil route unique-id))
|
||||||
(type (or (pathname-type result) (page-ext *config*))))
|
(type (or (pathname-type result) (page-ext *config*))))
|
||||||
(make-pathname :name (funcall (name-fn *config*)
|
(make-pathname :name (funcall (name-fn *config*) (pathname-name result))
|
||||||
(pathname-name result))
|
:type type
|
||||||
:type (when (string/= type "")
|
|
||||||
(if (or (string-equal "index"
|
|
||||||
(pathname-name result))
|
|
||||||
(string-equal "1"
|
|
||||||
(pathname-name result)))
|
|
||||||
(index-ext *config*)
|
|
||||||
type))
|
|
||||||
:defaults result))))
|
:defaults result))))
|
||||||
|
|
||||||
(defun get-route (doc-type)
|
(defun get-route (doc-type)
|
||||||
|
|
Loading…
Add table
Reference in a new issue