* Create preamble from an .org file ?
@ 2012-03-27 9:04 Vincent Beffara
2012-03-27 20:11 ` Bastien
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Beffara @ 2012-03-27 9:04 UTC (permalink / raw)
To: emacs-orgmode
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 <head> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Create preamble from an .org file ?
2012-03-27 9:04 Create preamble from an .org file ? Vincent Beffara
@ 2012-03-27 20:11 ` Bastien
2012-03-28 16:06 ` Vincent Beffara
0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2012-03-27 20:11 UTC (permalink / raw)
To: Vincent Beffara; +Cc: emacs-orgmode
Hi Vincent,
Vincent Beffara <vbeffara@ens-lyon.fr> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Create preamble from an .org file ?
2012-03-27 20:11 ` Bastien
@ 2012-03-28 16:06 ` Vincent Beffara
0 siblings, 0 replies; 3+ messages in thread
From: Vincent Beffara @ 2012-03-28 16:06 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-28 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27 9:04 Create preamble from an .org file ? Vincent Beffara
2012-03-27 20:11 ` Bastien
2012-03-28 16:06 ` Vincent Beffara
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).