site  news  contact

Category front-pages

September 16, 2017 — BarryK

A very useful feature is the per-category front-page. This is only for document mode.

Without a category front-page, if you point your browser at one of the category folders, say http://bkhome.org/shellcms, there is a index.html file there, which has a line like this in it (in the head section):

<meta http-equiv="refresh" content="0; url=http://bkhome.org/tag_shellcms.html" />

This causes a redirection to tag_shellcms.html, which has the posts for that tag (category).

However, you can create an index.html that becomes the front-page for that category. This is how to create it:

# ./shellcms www post shellcms/index.htmraw

Where www is the path to the installation of shellCMS, and post is for creating a new post.

In earlier tutorials there was nothing after post, however, that last parameter is optional and can be used to predetermine the category folder and name of the post.
Without that extra parameter, the shellcms script will ask you what tag (category) you want the post to go into, and will generate the filename of the post from the title.

Having run the above, you can then write a nice introduction/overview of that category. After saving and exiting the HTML editor, index.html will get generated, with your introduction, followed by a horizontal rule, then links to all the other posts under that category.

Of course "a picture is worth a thousand words", so here is a front-page that I have created:

http://bkhome.org/shellcms

So easy to create per-category front-pages, but note also, it has its own banner at the top.

if you put a image named top-banner.png into www/shellcms/images, it will be automatically used, instead of the default one (which is at www/images0).

That's about it, so simple. You can edit it, just like any other post:

# ./shellcms www edit shellcms/index.htmraw

I have some thoughts for future enhancements, stay tuned!

Tags: shellcms