(setq user-full-name "Stephane Adjemian") (setq user-mail-address "stepan@adjemian.eu") (set-language-environment "UTF-8") (require 'package) (setq package-enable-at-startup nil) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) (package-initialize) (use-package ox-publish :init (setq sa-blog-header-file "~/website/stephane-adjemian.fr/assets/partials/header.html" sa-blog-footer-file "~/website/stephane-adjemian.fr/assets/partials/footer.html" org-html-validation-link nil make-backup-files nil) (defun sa-blog-header (arg) (with-temp-buffer (insert-file-contents sa-blog-header-file) (buffer-string))) (defun sa-blog-footer (arg) (with-temp-buffer (insert-file-contents sa-blog-footer-file) (buffer-string))) (defun sa-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 '( ;; Content that should be processed. ("pages" :base-directory "./sources" :base-extension "org" :publishing-directory "./output" :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 sa-blog-header :html-postamble sa-blog-footer ) ;; For static files (untouched by emacs) ("static" :base-directory "./sources" :base-extension "asc\\|css\\|scss\\|less\\|ttf\\|woff\\|woff2\\|eot\\|yml\\|json\\|js\\|png\\|ttf\\|jpg\\|gif\\|pdf\\|svg\\|tex\\|m\\|py\\|jl" :publishing-directory "./output" :recursive t :publishing-function org-publish-attachment ) ;; Combine the two previous components in a single one ("site" :components ("pages" "static")))) (add-to-list 'org-export-filter-link-functions 'sa-filter-local-links) )