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: 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 oroutin the same directory as the blog source file.template-dir: location of the template directory defined by the#+TEMPLATE_DIR:header directive or thetemplatesdirectory of theo-bloglibrary.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 post 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-filterdefault 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: disqus account (called a forum on Disqus) this system belongs to. Defined by the \"#DISQUS\" header.filename-sanitizer: 1-argument function to be used to sanitize post filenames. Defined by#+FILENAME_SANITIZER:orob-sanitize-string.
Example:
;; get the title of the current blog defined in variable BLOG. (ob:blog-title BLOG)
Structures: ob:post
id: the post 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 theCLOSEDproperty or the current time.year: numerical year computed fromtimestamp.month: numerical month computed fromtimestamp.day: numerical day computed fromtimestamp.category: category read fromCATEGORYproperty orgblog.tags: list ofob:tags.template: template to use for current post read fromTEMPLATEproperty 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: string defying the tag name.safe: web safe tag name for URL.count: how many time the tag is used.size: the font size in percent.
Example:
;; get the name of the tag defined in variable TAG. (ob:tags-name TAG)
变量
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 what is exported).ALL-POSTS: A copy ofPOSTSexcept this always contents 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): post (or static page) being currently published.TAG(ob:tags): tag being currently published.CATEGORY(string): the category being published.YEAR,MONTH (=integer): the year and month being published.PATH-TO-ROOT(string): (intern use only, useob:path-to-rootinstead) path to blog root used byob:path-to-root.