cleanup rss, org is bad for that
This commit is contained in:
parent
b60cb386b4
commit
4bba5afe5d
5 changed files with 54 additions and 106 deletions
126
project.el
126
project.el
|
@ -6,15 +6,9 @@
|
||||||
(defvar assets-dir (concat base-dir "/"))
|
(defvar assets-dir (concat base-dir "/"))
|
||||||
(defvar publish-assets-dir (concat publish-dir "/"))
|
(defvar publish-assets-dir (concat publish-dir "/"))
|
||||||
(defvar posts-dir (concat base-dir "/posts"))
|
(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 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 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 css-path "/css/minimalist.css")
|
||||||
(defvar author-name "Yann Esposito")
|
(defvar author-name "Yann Esposito")
|
||||||
(defvar author-email "yann@esposito.host")
|
(defvar author-email "yann@esposito.host")
|
||||||
|
@ -33,8 +27,7 @@
|
||||||
(concat
|
(concat
|
||||||
"<link rel=\"stylesheet\" type=\"text/css\" href=\"" css-path "\"/>"
|
"<link rel=\"stylesheet\" type=\"text/css\" href=\"" css-path "\"/>"
|
||||||
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
|
||||||
"<link rel=\"alternative\" type=\"application/rss+xml\" title=\"" rss-title "\" href=\"/posts/rss.xml\" />"
|
"<link rel=\"alternative\" type=\"application/rss+xml\" title=\"" rss-title "\" href=\"/rss.xml\" />"
|
||||||
"<link rel=\"alternative\" type=\"application/rss+xml\" title=\"" micro-rss-title "\" href=\"/micro/rss.xml\" />"
|
|
||||||
"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicon.ico\">"))
|
"<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/favicon.ico\">"))
|
||||||
|
|
||||||
(defun menu (lst)
|
(defun menu (lst)
|
||||||
|
@ -44,7 +37,7 @@
|
||||||
(mapconcat 'identity
|
(mapconcat 'identity
|
||||||
(append
|
(append
|
||||||
'("<a href=\"/index.html\">Home</a>"
|
'("<a href=\"/index.html\">Home</a>"
|
||||||
"<a href=\"/posts/index.html\">Posts</a>"
|
"<a href=\"/archive.html\">Posts</a>"
|
||||||
"<a href=\"/slides.html\">Slides</a>"
|
"<a href=\"/slides.html\">Slides</a>"
|
||||||
"<a href=\"/about-me.html\">About</a>")
|
"<a href=\"/about-me.html\">About</a>")
|
||||||
lst)
|
lst)
|
||||||
|
@ -139,45 +132,11 @@
|
||||||
|
|
||||||
(defun date-format-entry (entry _style project)
|
(defun date-format-entry (entry _style project)
|
||||||
"Return string for each ENTRY in PROJECT."
|
"Return string for each ENTRY in PROJECT."
|
||||||
(cond ((not (directory-name-p entry))
|
(when (string-match "posts/.*" entry)
|
||||||
(let* ((file (org-publish--expand-file-name entry project))
|
(let* ((file (org-publish--expand-file-name entry project))
|
||||||
(title (org-publish-find-title entry project))
|
(title (org-publish-find-title entry project))
|
||||||
(date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))))
|
(date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))))
|
||||||
(format "- [%s] [[file:%s][%s]]\n" date file title)))
|
(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)))))
|
|
||||||
|
|
||||||
(defun org-blog-sitemap-fn-descr (descr title list)
|
(defun org-blog-sitemap-fn-descr (descr title list)
|
||||||
"Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
|
"Return sitemap using TITLE and LIST returned by `org-blog-sitemap-format-entry'."
|
||||||
|
@ -185,8 +144,7 @@
|
||||||
"#+AUTHOR: " author-name "\n"
|
"#+AUTHOR: " author-name "\n"
|
||||||
"#+EMAIL: " author-email "\n"
|
"#+EMAIL: " author-email "\n"
|
||||||
"#+DESCRIPTION: " descr "\n"
|
"#+DESCRIPTION: " descr "\n"
|
||||||
(mapconcat (lambda (li)
|
(mapconcat (lambda (li) (format "%s" (car li)))
|
||||||
(format "%s" (car li)))
|
|
||||||
(seq-filter #'car (cdr list))
|
(seq-filter #'car (cdr list))
|
||||||
"\n")))
|
"\n")))
|
||||||
|
|
||||||
|
@ -240,11 +198,32 @@ Return output file name."
|
||||||
(defalias 'org-blog-posts-sitemap-fn
|
(defalias 'org-blog-posts-sitemap-fn
|
||||||
(apply-partially 'org-blog-sitemap-fn-descr posts-descr))
|
(apply-partially 'org-blog-sitemap-fn-descr posts-descr))
|
||||||
|
|
||||||
(defalias 'org-blog-sitemap-format-entry-posts
|
(defun y/org-rss-publish-to-rss (plist filename pub-dir)
|
||||||
(apply-partially 'org-blog-sitemap-format-entry "posts"))
|
(if (equal "rss.org" (file-name-nondirectory filename))
|
||||||
|
(org-rss-publish-to-rss plist filename pub-dir)))
|
||||||
|
|
||||||
(defun donothing (_x _y _z)
|
(defun y/format-rss-feed (title list)
|
||||||
nil)
|
(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
|
(setq org-publish-project-alist
|
||||||
`(("orgfiles"
|
`(("orgfiles"
|
||||||
|
@ -266,39 +245,29 @@ Return output file name."
|
||||||
:html-head-extra ,org-blog-head
|
:html-head-extra ,org-blog-head
|
||||||
:html-preamble org-blog-preamble
|
:html-preamble org-blog-preamble
|
||||||
:html-postamble org-blog-postamble
|
: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
|
:auto-sitemap t
|
||||||
:sitemap-filename "index.org"
|
:sitemap-filename "archive.org"
|
||||||
:sitemap-title "Articles"
|
:sitemap-title "Articles"
|
||||||
:sitemap-style list
|
:sitemap-style list
|
||||||
:sitemap-sort-files anti-chronologically
|
:sitemap-sort-files anti-chronologically
|
||||||
:sitemap-format-entry date-format-entry
|
:sitemap-format-entry date-format-entry
|
||||||
:sitemap-function org-blog-posts-sitemap-fn)
|
:sitemap-function org-blog-posts-sitemap-fn)
|
||||||
|
|
||||||
("posts-rss"
|
("rss"
|
||||||
:base-directory ,posts-dir
|
:base-directory ,posts-dir
|
||||||
:base-extension "org"
|
:base-extension "org"
|
||||||
:publishing-directory "/dev/null"
|
|
||||||
:recursive t
|
:recursive t
|
||||||
:publishing-function donothing
|
:publishing-directory ,publish-dir
|
||||||
:with-title nil
|
:publishing-function y/org-rss-publish-to-rss
|
||||||
:with-date t
|
:rss-extension "xml"
|
||||||
|
:rss-image-url "https://her.esy.fun/img/FlatAvatar.png"
|
||||||
:auto-sitemap t
|
:auto-sitemap t
|
||||||
:sitemap-filename "rss.org"
|
:sitemap-filename "rss.org"
|
||||||
:sitemap-title "Used For RSS"
|
:sitemap-title "her.esy.fun"
|
||||||
:sitemap-style list
|
:sitemap-style list
|
||||||
:sitemap-sort-files anti-chronologically
|
:sitemap-function y/format-rss-feed
|
||||||
:sitemap-format-entry org-blog-sitemap-format-entry-posts
|
:sitemap-format-entry y/format-rss-feed-entry)
|
||||||
:sitemap-function org-blog-posts-sitemap-fn)
|
|
||||||
|
|
||||||
("assets"
|
("assets"
|
||||||
:base-directory ,assets-dir
|
:base-directory ,assets-dir
|
||||||
|
@ -308,20 +277,7 @@ Return output file name."
|
||||||
:publishing-function org-blog-publish-attachment
|
:publishing-function org-blog-publish-attachment
|
||||||
:recursive t)
|
:recursive t)
|
||||||
|
|
||||||
("rss"
|
("blog" :components ("orgfiles" "assets"))))
|
||||||
: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"))))
|
|
||||||
|
|
||||||
;; add target=_blank and rel="noopener noreferrer" to all links by default
|
;; 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)
|
(defun my-org-export-add-target-blank-to-http-links (text backend info)
|
||||||
|
|
9
src/archive.org
Normal file
9
src/archive.org
Normal file
|
@ -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]]
|
BIN
src/img/FlatAvatar.png
Normal file
BIN
src/img/FlatAvatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
|
@ -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!
|
|
|
@ -4,6 +4,7 @@
|
||||||
#+EMAIL: yann@esposito.host
|
#+EMAIL: yann@esposito.host
|
||||||
#+DATE: [2019-08-17 Sat]
|
#+DATE: [2019-08-17 Sat]
|
||||||
#+KEYWORDS: programming, blog, org-mode, web, css
|
#+KEYWORDS: programming, blog, org-mode, web, css
|
||||||
|
#+DESCRIPTION: Meta article about how I generate this blog.
|
||||||
#+OPTIONS: auto-id:t
|
#+OPTIONS: auto-id:t
|
||||||
|
|
||||||
#+begin_notes
|
#+begin_notes
|
||||||
|
|
Loading…
Reference in a new issue