diff --git a/Makefile b/Makefile index 1ac5a9e..f0fedbb 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ docs: ./build.el docs serve: build - npx http-server ./build + npx http-server ./build/site-build/ .PHONY: deploy-docs deploy-docs: docs diff --git a/core/fg42/build/docs.el b/core/fg42/build/docs.el index 2a92f8c..53e6914 100644 --- a/core/fg42/build/docs.el +++ b/core/fg42/build/docs.el @@ -59,7 +59,7 @@ (copy-directory (from-root "/docs/site/pages") build-dir nil t)) -(defun fg42/build-prepare-docs (build-dir) +(defun fg42/build-prepare-docs (build-dir host) "Prepare the documents and the website in the given BUILD-DIR." (fg42/build-docs-copy-base build-dir) @@ -77,10 +77,10 @@ (cons :links (mapconcat (lambda (c) (format "- [[%s][%s]]\n" ;; href - (format "%s/cubes/%s.org" build-dir c) + (format "%s/cubes/%s.html" host c) ;; title (plist-get (symbol-plist c) :title))) - fg42/available-cubes))))) + (sort fg42/available-cubes 'string<)))))) (defun all-org-files () @@ -137,7 +137,7 @@ Not pages." (->epoch (get-file-global-props file "DATE")) (get-file-global-props file "TITLE") (replace-regexp-in-string "\\.org" ".html" - (file-name-nondirectory file))) + (file-name-nondirectory file))) result) result))) files @@ -247,11 +247,11 @@ Not pages." (files (cdr (assoc tag (cdr tags))))) (when (null tag) (message "[Error]: The following files are missig a category: %s" - (mapconcat - (lambda (x) (format " %s\n" x)) - (sort - (mapcar #'pair-file-with-date files) - (lambda (x y) (> (car x) (car y)))))) + (mapconcat + (lambda (x) (format " %s\n" x)) + (sort + (mapcar #'pair-file-with-date files) + (lambda (x y) (> (car x) (car y)))))) (error "The above list of files are missing a category")) (copy-template @@ -276,34 +276,34 @@ Not pages." (defun fg42/build-docs (build-dir) "Build the documents and the website in the given BUILD-DIR." - ;; Create org files for the cubes - (fg42/build-prepare-docs build-dir) - - ;; We will use the org-agenda to extract all the tags - - ;;; Set the dir containing org the org-files - (setq org-directory (expand-file-name "site" build-dir)) - - ;;; Discover all the org files - (setq org-agenda-files (all-org-files)) - - (setf user-full-name author-name) - (setf user-mail-address author-email) - - ;; Disable default header links (top, next) - (setf org-html-home/up-format "") - (setf org-html-link-up "") - (setf org-html-link-home "") - (setf org-html-scripts "") - - (copy-template (from-root "/docs/site/config.org") - (expand-file-name "config.org" build-dir) - '()) - (let ((base-url (if (prod-p) "https://fg42.org" "http://localhost:3003")) (stage1-dir (expand-file-name "site" build-dir)) (final-dir (expand-file-name "site-build" build-dir))) + ;; Create org files for the cubes + (fg42/build-prepare-docs build-dir base-url) + + ;; We will use the org-agenda to extract all the tags + + ;;; Set the dir containing org the org-files + (setq org-directory (expand-file-name "site" build-dir)) + + ;;; Discover all the org files + (setq org-agenda-files (all-org-files)) + + (setf user-full-name author-name) + (setf user-mail-address author-email) + + ;; Disable default header links (top, next) + (setf org-html-home/up-format "") + (setf org-html-link-up "") + (setf org-html-link-home "") + (setf org-html-scripts "") + + (copy-template (from-root "/docs/site/config.org") + (expand-file-name "config.org" build-dir) + '()) + (message "Creating the main index file") (copy-template (from-root "/docs/site/templates/index.org") (expand-file-name "site/index.org" build-dir) @@ -390,7 +390,7 @@ Not pages." (org-publish-project "build" t nil) (message "Build complete.") -)) + )) (provide 'fg42/build/docs) ;;; docs.el ends here