Home |
blogmax.el works by substituting your text files into templates that you define. It looks in the directory containing the text file for the template and then in each parent directory until it finds it. Most sites will just have one template in the main directory, but you don't have to do it that way. And you can also have two different sites that share some templates by making their root directories both children of a directory containing the templates. You control the substitution with macros, some of which look up shortcuts, some of which pull in file content, and some of which report certain information about the current file or your blog as a whole. You can also use the full power of Emacs Lisp in a macro. There are four templates:
Here's the page-template.tmpl file for this site. Note the {txtLink} macro near the end of the file. That generates a link to the text file containing the page's contents. This allows you to easily get to the contents of each page in this site. <html> <head> <title>{siteName} - {title}</title> </head> <body> <font size="+3"><b> <a href="{blogToplevel}index.html"> {siteName}</a></b></font><br> <i>{byline}</i> <table width="99%"> <tr><td align="right" valign="top"> {include (concat (weblog-macro-blogToplevel) "side-links.inc")} </td> <td width="10px"> </td> <td width="1" bgcolor="gray"></td> <td width="10px"> </td> <td valign="top" width="99%"> {contentTemplate} </td></tr> </table> <hr size="1" noshade> <table width="99%" cellspacing="0" cellpadding="2" border="0"> <tr><td> <a href="http://www.gnu.org/software/emacs/"> <img src="{blogToplevel}emacs.png" alt="emacs" align="left"></a> Copyright © {year} by {author} <<a href="mailto:{email}">{email}</a>> </td><td align="right"> {txtLink "source"} </td></tr> </table> </body> </html> Here's the story-template.tmpl file for this site. This replaces {contentTemplate} in the text above. <table width="99%"> <tr> <td bgcolor="black"> <font size="+1" color="#f8f0ff"> <b>{title}</b> </font> </td> </tr> </table> {storyContent} Here's the file templates.txt that provides the content for this page. This replaces {storyContent} in the text above. <!--Templates--> <font size="-1"> <a href="mode.html">Weblog Mode</a> | <a href="index.html">Contents</a> | <a href="macros.html">Macros</a> </font> {@blogmax.el} works by substituting your text files into templates that you define. It looks in the directory containing the text file for the template and then in each parent directory until it finds it. Most sites will just have one template in the main directory, but you don't have to do it that way. And you can also have two different sites that share some templates by making their root directories both children of a directory containing the templates. You control the substitution with <a href="macros.html"> macros</a>, some of which look up shortcuts, some of which pull in file content, and some of which report certain information about the current file or your blog as a whole. You can also use the full power of Emacs Lisp in a macro. There are four templates: <ul> <li>The page template: <code>page-template.tmpl</code><br> This is the top-level template. Rendering of every page starts with the contents of this template. <li>The content template: <code>content-template.tmpl</code><br> This template is substituted for the \{contentTemplate} macro on daily blog pages, pages that are in your site's root directory. <li>The story template: <code>story-template.tmpl</code><br> This template is substituted for the \{contentTemplate} macro on story pages, pages that are in a sub-directory of your site's root direectory. <li>The day template: <code>day-template.tmpl</code><br> This template is substituted for the \{dayTemplate} macro. </ul> <hr> Here's the page-template.tmpl file for this site. Note the \{txtLink} macro near the end of the file. That generates a link to the text file containing the page's contents. This allows you to easily get to the contents of each page in this site. <blockquote> {include "../page-template.tmpl" t t} </blockquote> <hr> Here's the story-template.tmpl file for this site. This replaces \{contentTemplate} in the text above. <blockquote> {include "../story-template.tmpl" t t} </blockquote> <hr> <a name="text"> Here's the file <a href="templates.txt"> templates.txt</a> that provides the content for this page. This replaces \{storyContent} in the text above. <blockquote> {include "templates.txt" t t} </blockquote> <font size="-1"> <a href="mode.html">Weblog Mode</a> | <a href="index.html">Contents</a> | <a href="macros.html">Macros</a> </font> Weblog Mode | Contents | Macros
|
Copyright © 2002 by Bill St. Clair <bill@billstclair.com> | source |