Fix bugs with the web site publishing
Looking better.
This commit is contained in:
parent
108689c4da
commit
135e32e54b
2 changed files with 63 additions and 20 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
/ha-private.org
|
||||
/incubate.org
|
||||
/elisp/bookmark+*.el
|
||||
/.DS_Store
|
||||
|
|
|
@ -89,7 +89,7 @@ My main blog made up a collection of org files:
|
|||
:preparation-function org-mode-blog-prepare
|
||||
:export-with-tags nil
|
||||
:headline-levels 4
|
||||
:auto-preamble t
|
||||
:auto-preamble nil
|
||||
:auto-postamble nil
|
||||
:auto-sitemap t
|
||||
:sitemap-title "Howardisms"
|
||||
|
@ -103,14 +103,13 @@ My main blog made up a collection of org files:
|
|||
|
||||
:html-doctype "html5"
|
||||
:html-html5-fancy t
|
||||
:html-head-include-default-style nil
|
||||
;; :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-head
|
||||
:html-head-extra
|
||||
,(jack-html
|
||||
'((:meta (@ :http-equiv "X-Clacks-Overhead"
|
||||
:content "GNU Terry Pratchett"))
|
||||
(:link (@ :rel "stylesheet"
|
||||
'((:link (@ :rel "stylesheet"
|
||||
:type "text/css"
|
||||
:href "http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700&subset=latin,latin-ext"))
|
||||
(:link (@ :rel "stylesheet"
|
||||
|
@ -124,15 +123,12 @@ My main blog made up a collection of org files:
|
|||
:href "/css/styles.css"))
|
||||
(:script (@ :type "text/javascript"
|
||||
:src "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"))
|
||||
(:script (@ :src "/js/magic.js"
|
||||
:type "text/javascript"))
|
||||
(:link (@ :rel "icon"
|
||||
:href "/img/dragon.svg"))
|
||||
(:link (@ :rel "shortcut icon"
|
||||
:href "/img/dragon-head.svg"))
|
||||
(:meta (@ :name "viewport"
|
||||
:content "width=device-width, initial-scale=1"))))
|
||||
:html-head-include-default-style nil))
|
||||
(:script (@ :src "/js/magic.js" :type "text/javascript"))
|
||||
(:meta (@ :name "viewport" :content "width=device-width, initial-scale=1"))
|
||||
(:link (@ :rel "shortcut icon" :href "/img/dragon-head.svg"))
|
||||
(:link (@ :rel "icon" :href "/img/dragon.svg"))
|
||||
(:link (@ :rel "me" :href "https://emacs.ch/@howard"))
|
||||
(:meta (@ :http-equiv "X-Clacks-Overhead" :content "GNU Terry Pratchett"))))))
|
||||
#+end_src
|
||||
|
||||
Why not break out the images and other static files into a separate project:
|
||||
|
@ -242,6 +238,38 @@ I’ve been committing my literate-style Emacs configuration for years now, and
|
|||
:recursive t
|
||||
:publishing-function org-publish-attachment))
|
||||
#+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
|
||||
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)))
|
||||
(car)
|
||||
(cdr)))
|
||||
(src (plist-get conf :publishing-directory))
|
||||
(dest (cond
|
||||
((equal project "blog-content") "howardism")
|
||||
(parent (plist-get conf :publishing-directory))
|
||||
(combos (cond
|
||||
((equal project "blog-content")
|
||||
'("Technical" "howardism"
|
||||
"Personal" "howardism"
|
||||
"index.html" "howardism"
|
||||
"about-me.html" "howardabrams"))
|
||||
((equal project "blog-static") "howardism")
|
||||
((equal project "blog-rss") "howardism")
|
||||
((equal project "tech-notes") "howardabrams/technical")
|
||||
((equal project "tech-notes-static") "howardabrams/technical")
|
||||
((equal project "hamacs") "howardabrams/hamacs")
|
||||
((equal project "hamacs-static") "howardabrams/hamacs"))))
|
||||
(async-shell-command (format "rsync -az %s %s:%s" src host dest))))
|
||||
((equal project "hamacs-static") "howardabrams/hamacs")
|
||||
((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
|
||||
* Keybindings
|
||||
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 a" '("all" . org-publish-all)
|
||||
"o p p" '("project" . org-publish-project)
|
||||
"o p s" '("sync site" . ha-sync-site)
|
||||
"o p h" '("hamacs" . (lambda () (interactive)
|
||||
(org-publish-project "hamacs")
|
||||
(sit-for 30)
|
||||
|
|
Loading…
Reference in a new issue