6. Usage

6.1. Posting entry

The usual way to post comments is to use write_entry.pl filename entry-ID. When posting a new entry, ID should not be given. Author personally writes his weblog entries in files with running number, such as 009. In this case posting a new entry is done with the following command:


./write_entry.pl ~/weblog/009
write_entry.pl will then make sure you want to post a new entry, and that the categories are correct and should be created. Once the entry is written to database, write_entry.pl tells assigned entry ID.

Posted entry can then be reviewed before it is published. To see the entry, go to http://baseaddress/weblog.pl?entry=<ID>&unpub=1, where <ID> is entry ID. Once you think the entry is good to go, publish it with publish.pl entry-ID:


./publish.pl entry-ID

See Section 6.3 for entry file format.

6.2. Editing entry

Editing entries is almost identical to posting entries. The difference is that you will have to give entry ID to edit. You get the ID from write_entry.pl when you post your entry, but you can also view the entry ID in the URL. To extract the ID from URL, first follow the permalink to the entry, then compare the page URL to the following; each one of the following point to entry 9.

To edit existing entry, run write_entry.pl filename ID.


./write_entry.pl ~/weblog/009 9
This will print information about the old entry. If write_entry.pl thinks it is possible that you could be editing wrong entry, it asks you to confirm what you're doing.

6.3. Weblog entry file format

Each weblog entry file must follow certain format. File consists of header, an empty line, and content.


Title: My first weblog entry
Date: 2007-10-11 17:07:05
Categories: testing, intro

<p>This is my first weblog entry. By default it should be in plain HTML
as it is included as-is in the (X)HTML file.</p>

Header part consists of three fields, title, date, and list of categories. If undefined, date defaults to current timestamp. Each entry can be in abritary number of categories. If given more than one, categories are separated by commans (,).

Actual content, or payload, can by practically anything, but as it is included in the resulting page as-is, (X)HTML is usually preferred.