Skip to content

ratanvarghese/blom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blom, the Content Manager

This project is deprecated, the replacement is here.

Blom is the content manager for my blog. Other blogs should probably avoid using it.

Blom does the following tasks:

  • Takes title and tag information from the blog administrator
  • Sends articles through a template, allowing a static site to have a unified layout
  • Generates XML, Atom and JSON feeds
  • Generates a homepage with the latest content
  • Generates a chronological archive (Using the months of the tranquility calendar)
  • Generates an archive organized by tags
  • Show the current date (in Tranquility and Gregorian calendars) on every page. (Run blom through a cron job to stay up to date)

Notably, blom does not act as a file server. I use a seperate static server for my blog.

Unfortunately, blom is written in a manner which makes it difficult for other people to use. Generic content managers are a dime a dozen after all. I wrote this for fun, for knowledge and so that I could stick Tranquility dates everywhere.

Here are some features not yet implemented, that I might add in the future:

  • The ability to use hostnames other than my blog.
  • The ability to disable Tranquility dates.
  • Automatic GZIP compression
  • Automatic HTML/CSS minification.
  • Including the article modification date in the article's page.
  • Having the content for multiple articles on the home page.
  • Including more JSON Feed metadata
  • Generating pages of the JSON Feed based on article size (currently, every 15 articles is a page)

I don't see any of these as necessary for my blog right now.

Template Variables

The following variables are recognized for HTML templates:

  • {{.Title}}
  • {{.Today}} (the server date)
  • {{.Date}} (the publication date of the current article)
  • {{.ContentHTML}}

Note that the dates will be multiple lines: one line for the Tranquility date, and one for the Gregorian date.

Directory structure

Here is an example of a directory structure blom can understand:

.
├── blom
├── filetree.txt
├── home-template.html
├── public
│   ├── archive
│   │   └── index.html
│   ├── feeds
│   │   ├── atom
│   │   ├── json
│   │   └── rss
│   ├── hello
│   │   ├── attachments
│   │   │   └── 1200.jpg
│   │   ├── content.html
│   │   ├── index.html
│   │   └── item.json
│   ├── index.html
│   ├── markdown
│   │   ├── content.html
│   │   ├── content.md
│   │   ├── index.html
│   │   └── item.json
│   └── tags
│       └── index.html
└── template.html

As of the writing of these README, blom and *template.html can be anywhere in the file system. The blog root directory is public in this case.

The directories feeds, tags and archive must be present, and blom will not create them on its own. All the index.html, item.json are generated by blom. Files inside feeds are also generated by blom. JSON Feed pagination is supported, but not seen in this example.

The directories hello and markdown are articles. The hello article is generated from content.html (no other names or locations allowed). The paths of files in the attachments directory will be included as attachments to the article in the JSON Feed.

The markdown article is generated from content.md (no other names or locations allowed). Since content.md is present, content.html is ignored. This does mean that a content.md or content.html file will be accessible to visitors of the site. item.json will also be accessible. These files shouldn't be deleted if update mode is going to be used on a regular basis.

Article mode

When blom article is run, an index.html is generated from a content.html or content.md (the Markdown file has precedence), with the a template. Additionally a item.json is generated. This is essentially a single item of the JSON feed which is built in update mode.

Update mode

When blom update is run

  1. A list of every subdirectory of the blog root directory is generated.
  2. Directories with an item.json are processed as though article mode were run. A content.html or content.md must be present for this to succeed. Each article is processed in a seperate goroutine.
  3. If at least one article was found, the homepage (index.html in the blog root directory) is generated.
  4. The JSON feed is generated in feeds/json. Files of the form feeds/jsonX, where X is an integer, will be generated if there are over 15 articles.
  5. The Atom and RSS feeds are generated in feeds/atom and feeds/rss respectively.
  6. The tags page is generated at tags/index.html. Articles with multiple tags are listed multiple times, so this can get big.
  7. The archive page is generated at archive/index.html. Articles are sorted by Tranquility month, not by any Gregorian calendar unit.

Note that steps 3 to 7 are each run in seperate goroutines: if one of those steps fail, the others will continue.

About

Content Manager for a Static Blog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages