This is a blog that interfaces with a web server via SCGI. I have been thinking about writing some articles related to Linux, System administration and the likes, so I thought that writing the backend myself is just appropriate.
JBlog implements a Markdown engine and a memory cache for already computed entries.
To build this project, just run make. There aren't any special dependencies, as long as you have a relatively recent C compiler and POSIX compatible system you should be good to go!
To run this program, you are going to need a web server that can talk SCGI. Most well known web servers can.
For the purpose of testing I have included a lighttpd.conf file, with it, you can easily test this program with lighttpd.
Starting the JBLOG server
To start the JBLOG server, you simply run the jblog binary you build with the following arguments:
- -s Socket file
- -p html/xhtml pattern file (See below)
- -b directory with blog files
- -a admin save directory (optional)
- -u user the process will use (optional)
- -g group the process will use (optional)
- -d run as a daemon (optional)
- -l log file (optional)
- -r pid file (defaults to /run/jblog.pid)(optional)
After you did that, start the web server, make sure the config file of the web server has a valid user and points to the right socket!
The pattern file
The pattern file is a html/xhtml file that tells JBLOG what to put around the actual content of the blog. You mark where JBLOG can put its dynamic content with $BLOG$ and do whatever you want with the rest of the file!
The blog files
The Blog files are text files stored in the directory you defined above. They have a header that contains metadata like the author, release date and so on. The actual content starts after a delimiter "///" and is just markdown (although a limited subset of that, see LIMITATIONS).
blog Index files
Obviously, a blog is no good if you can't find any articles, so there are index files. JBLOG will server a list of blog entries that match what a few criteria specified in the index file. (For example subdirectory)
An index file is just a normal Blog file without a body (it ends with "///"). A few extra header entries are used to generate the index, these are:
- "Depth" defines how deep should be searched
- "DTypes" defines what Types will be listed
Updating cached entries
JBlog caches already computed entries. Because it wouldn't be very useful restarting the server every time you update a blog entry, simply add
/! to the end of the URL in your Browser. This will tell JBlog to recompute the requested file.
I've already mentioned a few planned features above, but here is a more complete list of the things planned for this:
- Visitor count tracking
- Tag support for better organization
- Primitive keyword based search
I am lazy, therefore a few markdown things are currently not implemented, a new markdown engine is in development, but it will likely also miss a few features.
THIS IS NOT PRODUCTION READY AT ALL
This program and all the files in this repository are licensed under the GPL v3 License, see LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html for more details.