Fix bugs with the web site publishing

Looking better.
This commit is contained in:
Howard Abrams 2024-01-18 20:52:06 -08:00
parent 108689c4da
commit 135e32e54b
2 changed files with 63 additions and 20 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
/ha-private.org /ha-private.org
/incubate.org /incubate.org
/elisp/bookmark+*.el /elisp/bookmark+*.el
/.DS_Store

View file

@ -89,7 +89,7 @@ My main blog made up a collection of org files:
:preparation-function org-mode-blog-prepare :preparation-function org-mode-blog-prepare
:export-with-tags nil :export-with-tags nil
:headline-levels 4 :headline-levels 4
:auto-preamble t :auto-preamble nil
:auto-postamble nil :auto-postamble nil
:auto-sitemap t :auto-sitemap t
:sitemap-title "Howardisms" :sitemap-title "Howardisms"
@ -103,14 +103,13 @@ My main blog made up a collection of org files:
:html-doctype "html5" :html-doctype "html5"
:html-html5-fancy t :html-html5-fancy t
:html-head-include-default-style nil
;; :html-preamble org-mode-blog-preamble ;; :html-preamble org-mode-blog-preamble
;; :html-postamble org-mode-blog-postamble :html-postamble org-mode-blog-postamble
;; :html-postamble "<hr><div id='comments'></div>" ;; :html-postamble "<hr><div id='comments'></div>"
:html-head :html-head-extra
,(jack-html ,(jack-html
'((:meta (@ :http-equiv "X-Clacks-Overhead" '((:link (@ :rel "stylesheet"
:content "GNU Terry Pratchett"))
(:link (@ :rel "stylesheet"
:type "text/css" :type "text/css"
:href "http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext")) :href "http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext"))
(:link (@ :rel "stylesheet" (:link (@ :rel "stylesheet"
@ -124,15 +123,12 @@ My main blog made up a collection of org files:
:href "/css/styles.css")) :href "/css/styles.css"))
(:script (@ :type "text/javascript" (:script (@ :type "text/javascript"
:src "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")) :src "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"))
(:script (@ :src "/js/magic.js" (:script (@ :src "/js/magic.js" :type "text/javascript"))
:type "text/javascript")) (:meta (@ :name "viewport" :content "width=device-width, initial-scale=1"))
(:link (@ :rel "icon" (:link (@ :rel "shortcut icon" :href "/img/dragon-head.svg"))
:href "/img/dragon.svg")) (:link (@ :rel "icon" :href "/img/dragon.svg"))
(:link (@ :rel "shortcut icon" (:link (@ :rel "me" :href "https://emacs.ch/@howard"))
:href "/img/dragon-head.svg")) (:meta (@ :http-equiv "X-Clacks-Overhead" :content "GNU Terry Pratchett"))))))
(:meta (@ :name "viewport"
:content "width=device-width, initial-scale=1"))))
:html-head-include-default-style nil))
#+end_src #+end_src
Why not break out the images and other static files into a separate project: Why not break out the images and other static files into a separate project:
@ -242,6 +238,38 @@ Ive been committing my literate-style Emacs configuration for years now, and
:recursive t :recursive t
:publishing-function org-publish-attachment)) :publishing-function org-publish-attachment))
#+end_src #+end_src
** Airbnb
I have an ADU on my property that I rent out through Airbnb. The place is full of QR Codes that display everything from local restaurants to how to play the Raspberry Pi Arcade my son and I built.
#+begin_src emacs-lisp
(add-to-list 'org-publish-project-alist
`("airbnb"
:base-directory "~/website/airbnb"
:publishing-directory ,(concat org-mode-publishing-directory "airbnb/")
:publishing-function org-html-publish-to-html
:recursive t
:auto-preamble nil
:auto-sitemap nil
:makeindex nil
:section-numbers nil
:html-head-include-default-style nil
:html-head ,(jack-html
'(:link (@ :rel "stylesheet" :type "text/css"
:href "airbnb.css")))
:html-head-extra nil
:table-of-contents nil
:with-author nil
:with-creator nil
:with-tags nil))
(add-to-list 'org-publish-project-alist
`("airbnb-static"
:base-directory "~/website/airbnb"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory ,(concat org-mode-publishing-directory "airbnb/")
:recursive t
:publishing-function org-publish-attachment))
#+end_src
* Including Sections * Including Sections
In the project definitions, I reference a =pre-= and =postamble= that allow me to inject some standard HTML file headers and footers: In the project definitions, I reference a =pre-= and =postamble= that allow me to inject some standard HTML file headers and footers:
@ -283,16 +311,29 @@ Using =rsync= to keep published files in sync with my website:
(seq-filter (lambda (lst) (string-equal (car lst) project))) (seq-filter (lambda (lst) (string-equal (car lst) project)))
(car) (car)
(cdr))) (cdr)))
(src (plist-get conf :publishing-directory)) (parent (plist-get conf :publishing-directory))
(dest (cond (combos (cond
((equal project "blog-content") "howardism") ((equal project "blog-content")
'("Technical" "howardism"
"Personal" "howardism"
"index.html" "howardism"
"about-me.html" "howardabrams"))
((equal project "blog-static") "howardism") ((equal project "blog-static") "howardism")
((equal project "blog-rss") "howardism") ((equal project "blog-rss") "howardism")
((equal project "tech-notes") "howardabrams/technical") ((equal project "tech-notes") "howardabrams/technical")
((equal project "tech-notes-static") "howardabrams/technical") ((equal project "tech-notes-static") "howardabrams/technical")
((equal project "hamacs") "howardabrams/hamacs") ((equal project "hamacs") "howardabrams/hamacs")
((equal project "hamacs-static") "howardabrams/hamacs")))) ((equal project "hamacs-static") "howardabrams/hamacs")
(async-shell-command (format "rsync -az %s %s:%s" src host dest)))) ((equal project "airbnb") "howardabrams/airbnb")
((equal project "airbnb-static") "howardabrams/airbnb"))))
;; (dolist (tuple (seq-partition combos 2))
;; (seq-let (src dest) tuple
;; (format "rsync -az %s/%s %s:%s" parent src host dest)))
(thread-last (seq-partition combos 2)
(seq-map (lambda (tuple) (seq-let (src dest) tuple
(format "rsync -avz %s%s %s:%s" parent src host dest))))
(s-join "; ")
(async-shell-command))))
#+end_src #+end_src
* Keybindings * Keybindings
Make it easy to publish all projects or single project: Make it easy to publish all projects or single project:
@ -302,6 +343,7 @@ Make it easy to publish all projects or single project:
"o p" '(:ignore t :which-key "publish") "o p" '(:ignore t :which-key "publish")
"o p a" '("all" . org-publish-all) "o p a" '("all" . org-publish-all)
"o p p" '("project" . org-publish-project) "o p p" '("project" . org-publish-project)
"o p s" '("sync site" . ha-sync-site)
"o p h" '("hamacs" . (lambda () (interactive) "o p h" '("hamacs" . (lambda () (interactive)
(org-publish-project "hamacs") (org-publish-project "hamacs")
(sit-for 30) (sit-for 30)