diff --git a/build.el b/build.el index 534b28b..f2f1dc7 100755 --- a/build.el +++ b/build.el @@ -71,13 +71,6 @@ PARAMS: (command-> command args ((string= command "docs") (do-command - (require 'fpkg) - (fpkg/use dash) - (fpkg/use mustache) - (fpkg/use ht) - (fpkg/use htmlize) - - (require 'fg42/build/docs) (fg42/build-docs build-dir))) diff --git a/core/fg42/build/docs.el b/core/fg42/build/docs.el index 77bcf20..b4d6d80 100644 --- a/core/fg42/build/docs.el +++ b/core/fg42/build/docs.el @@ -25,7 +25,15 @@ ;; way. Cubes are composable and a composition of cubes creates an editor. ;; ;;; Code: +(require 'fpkg) +(fpkg/use dash) +(fpkg/use mustache) +(fpkg/use ht) +(fpkg/use htmlize) +(fpkg/use ox-rss) + (require 'ox-html) +(require 'ox-rss) (require 'cubes/all) (require 'fg42/build/core) @@ -166,6 +174,26 @@ Not pages." "\n"))) +(defun latest-org-list-rss (base-url) + "Return a list of headlines (using BASE-URL) for the RSS." + (let ((posts (get-all-sorted-posts))) + (mapconcat + (lambda (post) + (format "* %s\n:PROPERTIES:\n:RSS_PERMALINK:%s%s/%s?%s\n:END:" + ;; Title + (nth 1 post) + base-url + fg42/build-docs-pages-dir + ;; Path + (nth 2 post) + ;; Hash + (car post) + ;; Title + (nth 1 post))) + posts + "\n"))) + + (defun get-all-categories () "Return all the categories of the org files." (seq-reduce @@ -338,6 +366,12 @@ Not pages." (expand-file-name "site/tags/index.org" build-dir) `((:links . ,(tags-org-list)))) + (message "Creating the rss feed") + (copy-template (from-docs "/templates/rss.org") + (expand-file-name "site/rss.org" build-dir) + `((:base-url . ,base-url) + (:posts . ,(latest-org-list-rss base-url)))) + (create-tag-pages build-dir) (setq org-html-preamble #'preamble-fn) @@ -377,19 +411,32 @@ Not pages." :sitemap-filename "sitemap.inc" :sitemap-sort-files anti-chronologically :html-format-headline-function headline-format + :exclude "rss.org" :makeindex nil) + ("rss" + :base-directory ,stage1-dir + :base-extension "org" + :html-link-home ,base-url + :html-link-use-abs-url t + :rss-extension "xml" + :publishing-directory ,final-dir + :publishing-function (org-rss-publish-to-rss) + :section-numbers nil + :exclude ".*" ;; To exclude all files... + :include ("rss.org") ;; ... except index.org. + :table-of-contents nil) + ("statics" :base-directory ,stage1-dir :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|svg" :publishing-directory ,final-dir :recursive t :publishing-function org-publish-attachment) - ("build" :components ("website" "statics")))) + ("build" :components ("website" "statics" "rss")))) (org-publish-project "build" t nil) - (message "Build complete.") - )) + (message "Build complete."))) (provide 'fg42/build/docs) ;;; docs.el ends here