diff --git a/project.el b/project.el index be0642a..7363e87 100644 --- a/project.el +++ b/project.el @@ -6,15 +6,9 @@ (defvar assets-dir (concat base-dir "/")) (defvar publish-assets-dir (concat publish-dir "/")) (defvar posts-dir (concat base-dir "/posts")) -(defvar posts-publish-dir (concat publish-dir "/posts")) -(defvar micro-dir (concat base-dir "/micro")) -(defvar micro-publish-dir (concat publish-dir "/micro")) -(defvar rss-dir base-dir) (defvar rss-title "Subscribe to articles") -(defvar micro-rss-title "Subscribe to micro blogs") +(defvar rss-description "her.esy.fun articles, mostly random personal thoughts") (defvar posts-descr "Articles") -(defvar micro-descr "Short micro blog entries à la twitter/mastodon") -(defvar publish-rss-dir publish-dir) (defvar css-path "/css/minimalist.css") (defvar author-name "Yann Esposito") (defvar author-email "yann@esposito.host") @@ -33,8 +27,7 @@ (concat "" "" - "" - "" + "" "")) (defun menu (lst) @@ -44,7 +37,7 @@ (mapconcat 'identity (append '("Home" - "Posts" + "Posts" "Slides" "About") lst) @@ -139,45 +132,11 @@ (defun date-format-entry (entry _style project) "Return string for each ENTRY in PROJECT." - (cond ((not (directory-name-p entry)) - (let* ((file (org-publish--expand-file-name entry project)) - (title (org-publish-find-title entry project)) - (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)))) - (format "- [%s] [[file:%s][%s]]\n" date file title))) - ((eq style 'tree) - (file-name-nondirectory (directory-file-name entry))))) - -(defun org-blog-sitemap-format-entry (sub entry _style project) - "Return string for each ENTRY in PROJECT." - (cond ((not (directory-name-p entry)) - (let* ((file (org-publish--expand-file-name entry project)) - (title (org-publish-find-title entry project)) - (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))) - (link (concat domainname "/" sub "/" (file-name-sans-extension entry) ".html"))) - (with-temp-buffer - (insert (format "* [[file:%s][%s]]\n" file title)) - (org-set-property "RSS_PERMALINK" link) - (org-set-property "PUBDATE" date) - (org-id-get-create) - (insert-file-contents file) - - (goto-char 0) - (end-of-line) - (forward-char) - (while (re-search-forward "^#\\+\\(title\\|subtitle\\|options\\|keywords\\|date\\|email\\|author\\).*$" nil t) - (progn - (replace-match "") - (kill-line))) - - (goto-char 0) - (end-of-line) - (forward-char) - (while (re-search-forward "^\\*" nil t) - (replace-match "**")) - - (buffer-string)))) - ((eq style 'tree) - (file-name-nondirectory (directory-file-name entry))))) + (when (string-match "posts/.*" entry) + (let* ((file (org-publish--expand-file-name entry project)) + (title (org-publish-find-title entry project)) + (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)))) + (format "- [%s] [[file:%s][%s]]\n" date file title)))) (defun org-blog-sitemap-fn-descr (descr title list) "Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'." @@ -185,8 +144,7 @@ "#+AUTHOR: " author-name "\n" "#+EMAIL: " author-email "\n" "#+DESCRIPTION: " descr "\n" - (mapconcat (lambda (li) - (format "%s" (car li))) + (mapconcat (lambda (li) (format "%s" (car li))) (seq-filter #'car (cdr list)) "\n"))) @@ -240,11 +198,32 @@ Return output file name." (defalias 'org-blog-posts-sitemap-fn (apply-partially 'org-blog-sitemap-fn-descr posts-descr)) -(defalias 'org-blog-sitemap-format-entry-posts - (apply-partially 'org-blog-sitemap-format-entry "posts")) +(defun y/org-rss-publish-to-rss (plist filename pub-dir) + (if (equal "rss.org" (file-name-nondirectory filename)) + (org-rss-publish-to-rss plist filename pub-dir))) -(defun donothing (_x _y _z) - nil) +(defun y/format-rss-feed (title list) + (concat "#+TITLE: " title "\n" + "#+AUTHOR: " author-name "\n" + "#+EMAIL: " author-email "\n" + "#+DESCRIPTION: " rss-description "\n" + "\n" + (org-list-to-subtree list '(:icount "" :istart "")))) + +(defun y/format-rss-feed-entry (entry style project) + (cond ((not (directory-name-p entry)) + (let* ((file (org-publish--expand-file-name entry project)) + (title (org-publish-find-title entry project)) + (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))) + (link (concat domainname "/posts/" (file-name-sans-extension entry) ".html"))) + (with-temp-buffer + (insert (format "* [[file:%s][%s]]\n" file title)) + (org-set-property "RSS_PERMALINK" link) + (org-set-property "PUBDATE" date) + (org-set-property "ID" (org-auto-id-format title)) + (buffer-string)))) + ((eq style 'tree) + (file-name-nondirectory (directory-file-name entry))))) (setq org-publish-project-alist `(("orgfiles" @@ -266,39 +245,29 @@ Return output file name." :html-head-extra ,org-blog-head :html-preamble org-blog-preamble :html-postamble org-blog-postamble - :auto-sitemap nil) - ("posts-index" - :base-directory ,posts-dir - :base-extension "org" - :publishing-directory "/dev/null" - :exclude "rss\\.org" - :recursive t - :with-date t - :publishing-function donothing :auto-sitemap t - :sitemap-filename "index.org" + :sitemap-filename "archive.org" :sitemap-title "Articles" :sitemap-style list :sitemap-sort-files anti-chronologically :sitemap-format-entry date-format-entry :sitemap-function org-blog-posts-sitemap-fn) - ("posts-rss" + ("rss" :base-directory ,posts-dir :base-extension "org" - :publishing-directory "/dev/null" :recursive t - :publishing-function donothing - :with-title nil - :with-date t + :publishing-directory ,publish-dir + :publishing-function y/org-rss-publish-to-rss + :rss-extension "xml" + :rss-image-url "https://her.esy.fun/img/FlatAvatar.png" :auto-sitemap t :sitemap-filename "rss.org" - :sitemap-title "Used For RSS" + :sitemap-title "her.esy.fun" :sitemap-style list - :sitemap-sort-files anti-chronologically - :sitemap-format-entry org-blog-sitemap-format-entry-posts - :sitemap-function org-blog-posts-sitemap-fn) + :sitemap-function y/format-rss-feed + :sitemap-format-entry y/format-rss-feed-entry) ("assets" :base-directory ,assets-dir @@ -308,20 +277,7 @@ Return output file name." :publishing-function org-blog-publish-attachment :recursive t) - ("rss" - :base-directory ,rss-dir - :base-extension "org" - :html-link-home ,domainname - :html-link-use-abs-url t - :rss-extension "xml" - :publishing-directory ,publish-rss-dir - :publishing-function (org-rss-publish-to-rss) - :exclude ".*" - :include ("posts/rss.org") - :section-numbers nil - :table-of-contents nil) - - ("blog" :components ("posts-rss" "posts-index" "orgfiles" "assets" "rss")))) + ("blog" :components ("orgfiles" "assets")))) ;; add target=_blank and rel="noopener noreferrer" to all links by default (defun my-org-export-add-target-blank-to-http-links (text backend info) diff --git a/src/archive.org b/src/archive.org new file mode 100644 index 0000000..ae37819 --- /dev/null +++ b/src/archive.org @@ -0,0 +1,9 @@ +#+TITLE: Articles +#+AUTHOR: Yann Esposito +#+EMAIL: yann@esposito.host +#+DESCRIPTION: Articles +- [2019-08-18] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/project-el/index.org][Autoload Script by project]] + +- [2019-08-17] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/troll-2/index.org][Troll 2]] + +- [2019-08-17] [[file:/Users/yaesposi/y/her.esy.fun/src/posts/new-blog.org][New Blog]] diff --git a/src/img/FlatAvatar.png b/src/img/FlatAvatar.png new file mode 100644 index 0000000..081fc75 Binary files /dev/null and b/src/img/FlatAvatar.png differ diff --git a/src/micro/ping.org b/src/micro/ping.org deleted file mode 100644 index 1f51e0a..0000000 --- a/src/micro/ping.org +++ /dev/null @@ -1,18 +0,0 @@ -#+TITLE: Ping -#+KEYWORDS: social -#+AUTHOR: Yann Esposito -#+EMAIL: yann@esposito.host -#+DESCRIPTION: -#+LANGUAGE: en -#+LANG: en -#+OPTIONS: H:5 auto-id:t -#+STARTUP: showeverything - -Ping! - -* This is a test -:PROPERTIES: -:CUSTOM_ID: this-is-a-test -:END: - -pong! diff --git a/src/posts/new-blog.org b/src/posts/new-blog.org index ad75d27..77a35da 100644 --- a/src/posts/new-blog.org +++ b/src/posts/new-blog.org @@ -4,6 +4,7 @@ #+EMAIL: yann@esposito.host #+DATE: [2019-08-17 Sat] #+KEYWORDS: programming, blog, org-mode, web, css +#+DESCRIPTION: Meta article about how I generate this blog. #+OPTIONS: auto-id:t #+begin_notes