Skip to content

Instantly share code, notes, and snippets.

@Dreameh
Created April 5, 2019 20:51
Show Gist options
  • Save Dreameh/7d4a5493323d5b076700445b290f5117 to your computer and use it in GitHub Desktop.
Save Dreameh/7d4a5493323d5b076700445b290f5117 to your computer and use it in GitHub Desktop.
wowza
(use-package ox-publish
:ensure f
:init
(setq my-blog-header-file "~/Dropbox/only-org/partials/header.html"
my-blog-footer-file "~/Dropbox/only-org/partials/footer.html"
org-html-validation-link nil)
;; loading partials on memory
(defun my-blog-header (arg)
(with-temp-buffer
(insert-file-contents my-blog-header-file)
(buffer-string)))
(defun my-blog-footer (arg)
(with-temp-buffer
(insert-file-contents my-blog-footer-file)
(buffer-string)))
(defun filter-local-links (link backend info)
"Filter that converts all the /index.html links to /"
(if (org-export-derived-backend-p backend 'html)
(replace-regexp-in-string "/index.html" "/" link)))
:config
(setq org-publish-project-alist
'(;; Publish the posts
("blog-notes"
:base-directory "~/Dropbox/only-org"
:base-extension "org"
:publishing-directory "~/Dropbox/only-org/public"
:recursive t
:publishing-function org-html-publish-to-html
:headline-levels 4
:section-numbers nil
:html-head nil
:html-head-include-default-style nil
:html-head-include-scripts nil
:html-preamble my-blog-header
:html-postamble my-blog-footer
)
;; For static files
("blog-static"
:base-directory "~/Dropbox/only-org"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|eot\\|svg\\|woff\\|woff2\\|ttf"
:publishing-directory "~/Dropbox/only-org/public"
:recursive t
:publishing-function org-publish-attachment)
;; combine the two
("blog" :components ("blog-notes" "blog-static"))))
(add-to-list 'org-export-filter-link-functions 'filter-local-links))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment