X-Git-Url: http://git.vanrenterghem.biz/www2.vanrenterghem.biz.git/blobdiff_plain/590567daac36f083f85bcacad739f5e83e18aaaa..b2bea24adcf05dd3a24039da748223fddd2aa9dc:/maak-website.el diff --git a/maak-website.el b/maak-website.el index e0c8c06..1bb4897 100644 --- a/maak-website.el +++ b/maak-website.el @@ -1,33 +1,97 @@ (require 'ox-publish) (setq org-html-doctype "html5") +(setq org-html-divs '((preamble "header" "top") + (content "main" "content") + (postamble "footer" "postamble")) + org-html-container-element "section") +(setq org-html-head-include-default-style nil) +;(setq org-html-htmlize-output-type 'css) ; default: 'inline-css (defun website-header (info) (with-temp-buffer (insert-file-contents "~/websites/stage.vanrenterghem.biz/html/navbar.html") (buffer-string))) +(defun post-header (exp-plist) + (with-temp-buffer + (insert (format "" + (or (org-export-data (plist-get exp-plist ':title) exp-plist) + "none"))) + (goto-char (point-min)) + (insert-file-contents "~/websites/stage.vanrenterghem.biz/html/post-header.html") + ;(goto-char (point-max)) + ;(insert (format "

Tags: %s

" + ; (or (org-export-data (plist-get exp-plist :filetags) exp-plist) + ; "none"))) + (buffer-string))) + (defun website-footer (info) (with-temp-buffer (insert-file-contents "~/websites/stage.vanrenterghem.biz/html/footer.html") (buffer-string))) +(defun my-org-publish-sitemap-default-entry (entry style project) + "My format for site map ENTRY, as a string. +ENTRY is a file name. STYLE is the style of the sitemap. +PROJECT is the current project." + (cond ((not (directory-name-p entry)) + (format "%s - [[file:%s][%s]]" ;;the date and filename are added after the entry + (format-time-string "%e %b %Y" (org-publish-find-date entry project)) + entry + (org-publish-find-title entry project))) + ((eq style 'tree) + ;; Return only last subdir. + (file-name-nondirectory (directory-file-name entry))) + (t entry))) + (setq org-publish-project-alist - '(("orgfiles" + '(("pages" :base-directory "~/websites/stage.vanrenterghem.biz/source/" :base-extension "org" :publishing-directory "~/websites/stage.vanrenterghem.biz/target" :publishing-function org-html-publish-to-html - :exclude "assets*" ;; regexp :headline-levels 3 :section-numbers nil :with-toc nil + :html-head-include-default-style nil :html-head "" :html-preamble t + :html-preamble website-header + :html-postamble website-footer + ) + + ("posts" + :base-directory "~/websites/stage.vanrenterghem.biz/source/posts/" + :base-extension "org" + :publishing-directory "~/websites/stage.vanrenterghem.biz/target" + :publishing-function org-html-publish-to-html + :exclude "assets*\\|sitemap.org\\|index.org" ;; regexp + :html-content-class "container content inlinepage card h-entry" + :headline-levels 3 + :section-numbers nil + :with-toc nil + :with-title nil + :html-head-include-default-style nil + :html-head "\n + " + :html-preamble t + :html-divs ((preamble "header" "preamble") + (content "article" "inlinepage card h-entry") + (postamble "footer" "postamble")) :recursive t :auto-sitemap t - :html-preamble website-header + :html-preamble post-header :html-postamble website-footer + :sitemap-sort-folders ignore-errors + :sitemap-format-entry my-org-publish-sitemap-default-entry + :sitemap-sort-files anti-chronologically ) ("assets" @@ -37,4 +101,4 @@ :publishing-directory "~/websites/stage.vanrenterghem.biz/target/assets/" :publishing-function org-publish-attachment) - ("website" :components ("orgfiles" "assets")))) + ("website" :components ("posts" "pages" "assets"))))