projects
/
blog.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add the correct date format when creating post
[blog.git]
/
my-publish.el
diff --git
a/my-publish.el
b/my-publish.el
index
984bb11
..
b21533d
100644
(file)
--- a/
my-publish.el
+++ b/
my-publish.el
@@
-24,46
+24,46
@@
;;; Code:
;;; Code:
-;; (defconst root-dir "~/Private/blog/")
-
(require 'org)
(require 'ox-publish)
(require 'org)
(require 'ox-publish)
+(require 'htmlize)
;; To prevent inline-css when exporting html. will use external css
(setq org-html-htmlize-output-type 'css)
(setq blog-extra-head
(concat
;; To prevent inline-css when exporting html. will use external css
(setq org-html-htmlize-output-type 'css)
(setq blog-extra-head
(concat
- ;; "<link rel='stylesheet' href='" css-file "' />\n"
- "<link rel='stylesheet' href='../css/main.css' />\n"
- "<link rel='stylesheet' href='../css/code.css' />"
- ))
+ "<link rel='stylesheet' href='/css/my.css' />\n"
+ "<link rel='stylesheet' href='/css/code.css' />"))
(setq blog-header
(concat
(setq blog-header
(concat
- " <header id= 'banner' > "
- "<h1><a href= '/' >Peng Li</a></h1>"
- "<hr>"
+ "<header id= 'banner'>"
+ "<a class=\"title\"href= '/' >Peng Li</a>"
"<nav><ul>"
"<nav><ul>"
- "<li><a href= '/' >About</a></li>"
- "<li><a href= '/
blog
.html' >Blog</a></li>"
-
"<li><a href= '/home
.html' >Home</a></li>"
+ "<li><a href= '/
about.html
' >About</a></li>"
+ "<li><a href= '/
posts/sitemap
.html' >Blog</a></li>"
+
;; "<li><a href= '/index
.html' >Home</a></li>"
"</ul></nav>"
"</ul></nav>"
- "</header>"))
+ "</header>"
+ "<hr>"))
(setq blog-footer
(setq blog-footer
- "<hr />\n
-<p><span style=\"float: left;\"><a href= \"/blog.xml\">RSS</a></span>
-
License: <a href= \"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4.0</a></p\n"
)
+ (concat
+ "<hr />\n"
+
org-html-creator-string)
)
(defun blog-setup-project-alist (root-dir &optional output-dir)
"Set project alist. `output-dir' is the directory of publish-directory.
`root-dir' is the root directory of blog repository."
(defun blog-setup-project-alist (root-dir &optional output-dir)
"Set project alist. `output-dir' is the directory of publish-directory.
`root-dir' is the root directory of blog repository."
- (unless output-dir (setq output-dir (concat root-dir "_site/")))
+ (unless (> (length output-dir) 0)
+ (setq output-dir (concat root-dir "/_site/")))
+ (message "Blog dir is: %s\nOut dir is: %s"
+ (format root-dir)
+ (format output-dir))
(setq org-publish-project-alist
`(
("blog-pages"
(setq org-publish-project-alist
`(
("blog-pages"
- ;; publishing
:base-directory ,root-dir
:base-extension "org"
:publishing-directory ,output-dir
:base-directory ,root-dir
:base-extension "org"
:publishing-directory ,output-dir
@@
-82,10
+82,13
@@
License: <a href= \"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4
:html-head-include-scripts nil
:html-head-extra ,blog-extra-head
:html-preamble ,blog-header
:html-head-include-scripts nil
:html-head-extra ,blog-extra-head
:html-preamble ,blog-header
- :html-postamble ,blog-footer)
+ :html-postamble ,blog-footer
+
+ ;; other generic options
+ :with-toc nil
+ )
("blog-posts"
("blog-posts"
- ;; publishing
:base-directory ,(concat root-dir "/posts")
:base-extension "org"
:publishing-directory ,(concat output-dir "/posts")
:base-directory ,(concat root-dir "/posts")
:base-extension "org"
:publishing-directory ,(concat output-dir "/posts")
@@
-109,7
+112,13
@@
License: <a href= \"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4
;; sitemap
:auto-sitemap t
:sitemap-filename "sitemap.org"
;; sitemap
:auto-sitemap t
:sitemap-filename "sitemap.org"
- :sitemap-title "Sitemap")
+ :sitemap-title "Blog"
+ :sitemap-sort-files anti-chronologically
+ :sitemap-file-entry-format "%d %t"
+
+ ;; other generic options
+ :with-toc nil ; table of contents
+ )
("blog-css"
:base-directory ,(concat root-dir "/css")
("blog-css"
:base-directory ,(concat root-dir "/css")
@@
-125,13
+134,5
@@
License: <a href= \"https://creativecommons.org/licenses/by-sa/4.0/\">CC BY-SA 4
:recursive t)
("blog" :components ("blog-pages" "blog-posts" "blog-css" "blog-cgi")))))
:recursive t)
("blog" :components ("blog-pages" "blog-posts" "blog-css" "blog-cgi")))))
-
-(defun blog-publish (out-dir force)
- "publish the project"
- (interactive)
- (blog-setup-project out-dir)
- (org-publish-project "blog" force))
-
-
(provide 'my-publish)
;;; publish.el ends here
(provide 'my-publish)
;;; publish.el ends here