-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented prev/next links for content items.
- Loading branch information
1 parent
dfa4e90
commit 32c7a2b
Showing
13 changed files
with
189 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(uiop:define-package #:staticl/links/link | ||
(:use #:cl) | ||
(:import-from #:staticl/content | ||
#:content-title | ||
#:content) | ||
(:import-from #:serapeum | ||
#:dict | ||
#:dict* | ||
#:->) | ||
(:import-from #:staticl/url | ||
#:object-url) | ||
(:export | ||
#:link)) | ||
(in-package #:staticl/links/link) | ||
|
||
|
||
(defclass link () | ||
((content :initarg :content | ||
:type content | ||
:reader link-content))) | ||
|
||
|
||
(-> link (content) | ||
(values link &optional)) | ||
|
||
(defun link (content) | ||
"Creates a link to the given content piece. | ||
When such object is passed to the template, it is resolved to a | ||
page URL and title." | ||
(make-instance 'link | ||
:content content)) | ||
|
||
|
||
(defmethod staticl/theme:template-vars ((link link) &key (hash (dict))) | ||
(dict* hash | ||
"url" | ||
(object-url (link-content link)) | ||
"title" | ||
(content-title (link-content link)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(uiop:define-package #:staticl/links/prev-next | ||
(:use #:cl) | ||
(:import-from #:staticl/pipeline) | ||
(:import-from #:serapeum) | ||
(:import-from #:staticl/content | ||
#:set-metadata) | ||
(:import-from #:staticl/site | ||
#:site) | ||
(:import-from #:staticl/links/link | ||
#:link) | ||
(:export #:prev-next-links)) | ||
(in-package #:staticl/links/prev-next) | ||
|
||
|
||
(defclass prev-next-links () | ||
()) | ||
|
||
|
||
(defun prev-next-links () | ||
"Creates a links between pages." | ||
(make-instance 'prev-next-links)) | ||
|
||
|
||
(defmethod staticl/pipeline:process-items ((site site) (node prev-next-links) content-items) | ||
(loop for (prev item next) on (list* nil content-items) | ||
when item | ||
do (when prev | ||
(set-metadata item "prev" | ||
(link prev))) | ||
(when next | ||
(set-metadata item "next" | ||
(link next)))) | ||
(values)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters