Some variables are available when publishing lisp parts of templates. These
variables are defined using defstruct, then any slot (or property) is
available using a (type-slot variable)
form.
Structures
Structures: ob:blog
Structure used to define a blog:
file
: The blog source file (read-only).buffer
: Buffer visiting the blog file (read-only).publish-dir
: Where to publish the blog, defined by the#+PUBLISH_DIR:
header directive orout
in the same directory as the blog source file.template-dir
: Location of the template directory defined by the#+TEMPLATE_DIR:
header directive or thetemplates
directory of theo-blog
library.style-dir
: Path of the css files defined by the#STYLE_DIR:
header directive orstyle
. This directory is relative totemplate-dir
.posts-filter
: Default filter for posts defined by the#POSTS_FILTER:
header directive or+TODO={DONE}
.static-filter
: Default filter for static pages defined by the#STATIC_FILTER:
header directive or+PAGES={.*}
.snippet-filter
Default filter for snippets defined by the#SNIPPET_FILTER:
header directive or+SNIPPET={.*}
.title
: Blog title defined by the#+TITLE:
header directive.description
: Blog description defined by the#+DESCRIPTION:
header directive.url
: Blog base URL defined by the#+URL:
header.default-category
: Default category for posts defined by the#DEFAULT_CATEGORY:
header orBlog
.disqus
: The Disqus account (called a forum on Disqus) this o-blog site belongs to. Defined by the#+DISQUS:
header.filename-sanitizer
: A 1-argument function to be used to sanitize post filenames. Defined by#+FILENAME_SANITIZER:
orob-sanitize-string
.post-sorter
: A 2-argument function to be used to sort the posts. Defined by#+POST_SORTER:
orob-sort-posts-by-date
.
Example:
;; get the title of the current blog defined in variable BLOG. (ob:blog-title BLOG)
Structures: ob:post
id
: The post's numerical id. Posts are sort by reversed chronological order. The most recent post get the id 0.title
: The post title, read from the entry title.timestamp
: The post timestamp given by theCLOSED
property or the current time.year
: Numerical year computed fromtimestamp
.month
: Numerical month computed fromtimestamp
.day
: Numerical day computed fromtimestamp
.category
: Category read fromCATEGORY
property orgblog
.tags
: List ofob:tags
.template
: Template to use for current post read fromTEMPLATE
property orblog_post.html
.filepath
: Relative path from the blog root directory to the post directory (directory only).filename
: Sanitized filename generated fromtitle
.htmlfile
: Full relative path to the post html file (file and directory).path-to-root
: Relative path from the post html file to the blog root.content
: Raw content of the post (Org-mode format).content-html
: HTML export of the post.
Example:
;; Get the HTML content of the post defined in variable POST. (ob:post-content-html POST)
Structures: ob:tags
Structure used to define a tag:
name
: The string defining the tag name.safe
: Web/URL-safe tag name.count
: How many times the tag is used across posts.size
: The font size in percent.
Example:
;; get the name of the tag defined in variable TAG. (ob:tags-name TAG)
Variables
The following variables are always available when publishing a blog:
BLOG
(ob:blog
): Information about the blog being published.POSTS
(list ofob:post
): List of all posts of the blog or restricted list of posts (depending on what is exported).ALL-POSTS
: A copy ofPOSTS
except this always contains all the posts from the blog.STATIC
(list ofob:post
): List of static pages.SNIPPETS
(list ofob:post
): List of snippets pages.TAGS
(list ofob:tags
): List of all tags.
Some variables may be defined in some functions:
POST
(ob:post
): The post (or static page) being currently published.TAG
(ob:tags
): The tag being currently published.CATEGORY
(string
): The category being published.YEAR
,MONTH (=integer
): The year and month being published.PATH-TO-ROOT
(string
): (internal use only, useob:path-to-root
instead) Path to blog root used byob:path-to-root
.