From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Beffara Subject: Create preamble from an .org file ? Date: Tue, 27 Mar 2012 11:04:51 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCSKw-0005xe-MY for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 05:05:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCSKh-0000Sp-F2 for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 05:05:06 -0400 Received: from plane.gmane.org ([80.91.229.3]:36830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCSKh-0000SO-8Y for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 05:04:51 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SCSKf-0005LS-Cz for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 11:04:49 +0200 Received: from cxr69-3-82-225-61-110.fbx.proxad.net ([82.225.61.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Mar 2012 11:04:49 +0200 Received: from vbeffara by cxr69-3-82-225-61-110.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Mar 2012 11:04:49 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, To manage my personal website I would like to use the publish function of org-mode. For the contents of pages, there is no problem, and the auto-sitemap feature is promising. however, I would like to have some common contents to all the individual pages, and they would best fit in the preamble part. Essentially, I would have a preamble.org file containing this: -------- #+IMPORT: sitemap.org * A few links - link 1 - link 2 * Contact info - address - email -------- and the contents of the preamble would be an html version of that (of course without all the section and so on). Optimally, of course, preamble.org should not be linked from the site map. How do I do that? Maybe a dedicated .org file for the navigation bar is not the right way to do, is there a better one? Thanks, /vincent From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Create preamble from an .org file ? Date: Tue, 27 Mar 2012 22:11:57 +0200 Message-ID: <87k4254wbm.fsf@altern.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCg5w-0004u6-If for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 19:46:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCg5u-0007jJ-DH for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 19:46:32 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:57204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCg5u-0007ib-3r for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 19:46:30 -0400 Received: by wibhj13 with SMTP id hj13so340271wib.12 for ; Tue, 27 Mar 2012 16:46:26 -0700 (PDT) In-Reply-To: (Vincent Beffara's message of "Tue, 27 Mar 2012 11:04:51 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Vincent Beffara Cc: emacs-orgmode@gnu.org Hi Vincent, Vincent Beffara writes: > How do I do that? Maybe a dedicated .org file for the navigation bar is > not the right way to do, is there a better one? Since you only need to export your preamble in HTML once, I'd rather use `org-export-html-preamble' and set it to the HTML string you want. There may be other ways using #+INCLUDE but the solution above is the one I use. HTH, -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Beffara Subject: Re: Create preamble from an .org file ? Date: Wed, 28 Mar 2012 18:06:31 +0200 Message-ID: <4F733707.7000306@ens-lyon.fr> References: <87k4254wbm.fsf@altern.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCvOs-0006tN-31 for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 12:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCvOi-0008OS-7c for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 12:07:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:33688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCvOi-0008OG-0g for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 12:06:56 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SCvOf-0002P6-Jq for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 18:06:53 +0200 Received: from cxr69-3-82-225-61-110.fbx.proxad.net ([82.225.61.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Mar 2012 18:06:53 +0200 Received: from vbeffara by cxr69-3-82-225-61-110.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Mar 2012 18:06:53 +0200 In-Reply-To: <87k4254wbm.fsf@altern.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, >> How do I do that? Maybe a dedicated .org file for the navigation bar is >> not the right way to do, is there a better one? > > Since you only need to export your preamble in HTML once, I'd rather use > `org-export-html-preamble' and set it to the HTML string you want. Thanks for the tip. In terms of time spent to build a web page, that would have been the wise thing to do. However, I wanted something more modular, say being able to add a few pages without having to tweak the variable each time, and so on. So in the mean time I cobbled something together, which works for me and feels a bit more flexible if I want to modify the navigation bar in the page: (defun my-org-publish-org-to-html (plist filename pubdir) (org-pop-to-buffer-same-window (find-file "~/Boulot/org/web/preamble.org")) (let* ((preamble (org-export-as-html 3 nil nil 'string t)) (plist (plist-put plist :html-preamble preamble))) (org-publish-org-to-html plist filename pubdir))) (Everything is hard-coded, it should use the :base-directory and test whether :html-preamble is equal to 'file or something, and it does not feel optimal at all, if only because it exports the preamble once for every file - that's more like a proof-of-concept ...) The file .../preamble.org contains a few links and contact info, and the line to #+INCLUDE: the sitemap. Works reasonably well :-) and it could be something that others would find useful. Thanks again, Cheers, /vincent