emacsorphanage / org-page

[INACTIVE] A static site generator based on Emacs and org mode.
673 stars 99 forks source link

How to manager multi website in an emacs session? #119

Closed tumashu closed 9 years ago

tumashu commented 9 years ago

ox-publish' useorg-publish-project-alist' which can set multi website configure, How org-page deal with this problem?

I use the below code, but not satify...

(require 'org-page)

(defmacro eh-website-with-config (&rest body)
  `(let* ((op/repository-directory (file-name-directory
                                    (locate-library "eh-website")))
          (op/site-main-title "Tumashu 的个人小站")
          (op/site-sub-title "================ 九天十地,太上忘情!!!")
          (op/repository-org-branch "source")
          (op/repository-html-branch "master")
          (op/personal-github-link "https://github.com/tumashu/tumashu.github.com")
          (op/site-domain "http://tumashu.github.com/"))
     (when op/repository-directory
       ,@body)))

(defun eh-website-publish (&optional test)
  (interactive)
  (eh-website-with-config
   (op/do-publication t nil nil t)))

(defun eh-website-test ()
  (interactive)
  (let ((localhost "http://localhost/")
        (directory "/var/www/"))
    (eh-website-with-config
     (setq op/site-domain localhost)
     (op/do-publication t nil directory))
    (browse-url-of-file localhost)))

(defun eh-website-new-post (&optional category filename)
  (interactive
   (let* ((c (read-string "Category: " "blog"))
          (f (read-string "filename: " "new-post.org")))
     (list c f)))
  (if (string= category "")
      (setq category "blog"))
  (if (string= filename "")
      (setq filename "new-post.org"))
  (unless (string-suffix-p ".org" filename)
    (setq filename (concat filename ".org")))
  (eh-website-with-config
   (let* ((dir (concat (file-name-as-directory op/repository-directory)
                       (file-name-as-directory category)))
          (path (concat dir filename)))
     (if (file-exists-p path)
         (error "Post `%s' already exists." path))
     (unless (file-directory-p dir)
       (mkdir dir t))
     (switch-to-buffer (find-file path))
     (call-interactively 'op/insert-options-template)
     (save-buffer))))
sillykelvin commented 9 years ago

No, org-page is just a static blog generator, multi website management is not the main task, so I am afraid you have to do it yourself...

tumashu commented 9 years ago

Is is possible set all above setup with a variable, like `org-publish-project-alist' ,which will make multi website setting more easier.

tumashu commented 9 years ago

This seemd offtopic, I will create a new issue to discuss.