Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Lightweight Programmer's CMS?
25 points by amouat on July 12, 2009 | hide | past | favorite | 30 comments
Does anyone have any recommendations for a lightweight CMS?

I'm happy writing pages in HTML & CSS but I need something to take care of the menus, header and footer etc ("theme" if you like).

So far I've survived with a shell script that literally cats some common header and footer HTML onto my pages, but I feel there has to be a better solution.

Update: It seems what I'm looking for is often known as a "Static-site generator".



I wrote a single DEFPAGE macro that takes care of this.

  (defmacro defpage (name (uri &optional title) &body body)
    `(define-easy-handler (,name :uri ,uri) ()
        (with-html
          (:html
            (:head (:title (or ,title (string-titlize ,uri))))
            (:body
              (:div :id "container"
                ,@body))))))
Usage:

  (defpage aboutus ("/aboutus" "About Hacker News")
    (:h3 "Hacker News Consists of the following people:")
    (:ul :id "user-list"
       (dolist (user (list-all-users))
          (htm (:il user)))))
The one I use for my current project is 2 pages long and even generates SEO-friendly meta tags from the text content. In the future, I intend to make it index each page into a Common Lisp search engine (Montezuma) so I can search my entire site whenever I want.

I slice and dice CSS and html until I like the page layout, then abstract the common parts and put them in DEFPAGE. I even have session-based stuff that shows a login/logout stuff on the top of each page in tiny font, so logged in users can view the public pages and know they're still logged in.

[Edit: Tonight I wrote self-validating CLOS objects that map to a database record. They generate their own Lisp and Javascript validators and the validators are auto-invoked both on the client and the server whenever their respective object is instantiated. On the javascript side, instanciation is attached to the :action of a form; it's clean and pretty, but forces me to use a seperate form for each class/table. I only came up with the idea this afternoon, so give it some time.]


Somewhat unrelated, but is there a javascript library that I can use to generate html strings which can be used similarly to your lisp code? i.e., something like this:

  var users = [...];
  var s = h3("Hacker News Consists of the following people:");
  s += ul({id: 'user-list'}, map(li({'c': "userel"}), users));


I use newLisp's Wiki, it's small, simple and powerful. Easy to extend if you like. Take a look at : http://www.newlisp.org/index.cgi?Applications


Don't forget Webby (Ruby-based), which is pretty lightweight, but can be extended depending on your environment.

It features various markup languages, some syntax highlighting options, autobuild, and more.

http://webby.rubyforge.org/


Very similar is Nanoc, Ruby-based, lightweight, and flexible.

http://nanoc.stoneship.org/


I'm using Jekyll, the static site generator known from github pages. It will definitely be a step up from writing html and doing cat HEAD ARTICLE FOOT > PAGE :)


That looks pretty good, I'll probably give it a shot.

My only concern is that it seems oriented more towards blogs; do you think I'll have any problems using it for a small open-source project website?


The blog part will come handy for a project website, as you will probably have a news-section on the front page with release and event announcements.

You can use the 'topic' feature to select "non-blog" articles with a given topic. Say if you want a menu entry generated with links to all your 'documentation' topic pages.

I forget what the tool/library is called, but there is even support for syntax highlighting code. Lots of languages supported, even Erlang which is properly obscure I think.

I find the Yaml premable in articles very useful, if I add a description entry there, i can refer to page.description in my template to add a meta-description header, and in the RSS feed i can use it to summarize the article.

I also feel pretty secure in that if I would ever want to give up on Jekyll most of my site would be in textile format which is quite practical and supported by other things than ruby.


+1 for jekyll


Staticmatic is another static site generator that might be close to what you are looking for. You can write your pages in Haml and Sass, so in addition to much simpler markup and the ability to use inline textile and markdown, you can also pull the header and footer out into partials.

http://staticmatic.rubyforge.org/

http://github.com/staticmatic/staticmatic/tree/master


http://www.qrimp.com has a feature called "publisher" that you can use to convert any database content to a set of static files that it can then FTP to any server. You can modify your data, which in your case would be just the content between the header and footer, you can also include a header file or a footer file. The header and footer could change based on which area of your site (which data) you are publishing.

The data can be anything, products, customers, or lists of blog posts. The Qrimp blog is managed with the Qrimp publisher, for example: http://www.qrimp.com/blog/categories.Features.html

With the templating system, you can create complex query structures to pull in data from any table in your Qrimp app. It is a programming construct of sorts that allows you to create static pages that are the result of dynamic queries, so your website loads really fast, but it is based on a dynamic database.


I would advise using a wiki. Wikis fit well the programmers mental model as their main concept of editing "source" code that is compiled into a "machine" language (HTML). What wiki to use will depend on your favorite language or concepts. I use Foswiki http://foswiki.org (although I hate perl), because you can mix html/css/javastrict with the wiki syntax, and it has no database so I can hand edit easily the pages in emacs or use various shell hacks on them. But many nice wikis exist, for intance moinmoin is a nice one for python lovers.

I maintained my site with hand edited html, then I wrote a template engine for it, but for one year I have just ported everything on Foswiki (Foswiki is the active fork of TWiki), and have no regret. And if I want to add features, I can code plugins to it, use other people plugins.


If all you want to do is attach a header and footer to an otherwise static HTML page, why not just use SSI? http://httpd.apache.org/docs/1.3/howto/ssi.html


Good suggestion, but I think I'll go with one of the other solutions for a few reasons:

- I'd rather keep things completely static if I can

- It ties my site to Apache a bit

- I may as well take advantage of some of the other features Jekyll etc provide


I quite like ModX (http://modxcms.com/) although it might be a little on the bloated side for many here. It's a pretty bog-standard PHP/MySQL package.

Basically, you design and code up your pages as if they were static, then insert "template tags" where you want to put your title, content, footer, menu - all of which is then pulled from the CMS database. I might be barking up completely the wrong tree here but it works for me when I want to throw up a site quickly.


If you're just converting static content, Make + Markdown + small amounts of Awk/Perl/etc. should suffice.

There's also werc (http://werc.cat-v.org/).


Write one yourself in your favourite programming language! Don't forget to include (what I use on my blahg): a markup language (textile), code highlighting(pygments), a templating engine(mako), RSS.

The markup language and the templating engine are the things that really make this effort worth it. Especially since you can now use your favourite editor to edit posts. You can't really do that with wordpress.


I'd love to, but that's a bit much work. And I'd go mental when I wanted to urgently make a small change to the website but was forced to spend hours fixing some stupid bug.

I do use Wordpress at the minute, and pasting text from Vim tends to be painful, which is one of the reasons I don't want to use it for my project website.


Aeons ago, I wrote a language called SWL that served this exact purpose. It's an condensed HTML dialect, similar to later inventions like markdown and textile, but designed for programming and minimizing markup. It takes a template from the directory context and generates HTML from all the SWL files.

http://cixar.com/swl/


Has anyone used Hobix? http://www.hobix.com/.

Seems very hard to beat a lisp style solution such as the one posted by mahmud. lisp html generation always seems so much more concise than other languages.

I've started writing one in python similar to mahmuds. Might be the perfect time for me to learn clojure.


There is also the WML (Website Meta Language) at http://www.thewml.org/ -- I used it for a few static websites in the early 2000s, but it isn't maintained any more. It combines an HTML macro package, embedded perl, m4 and a few other tools into a nine-pass compiler.


Try http://github.com/btbytes/webgen.py . This is a static site generator written in Python.

It's a single Python file, with support to mardown, textile etc. The template is one single file too which is based on YUI.


I just use 2 shell scripts, cat.cgi and index.cgi, at my blog

http://mv.asterisco.pt/cat.cgi?cat.cgi http://mv.asterisco.pt/cat.cgi?index.cgi

(View source)

-- MV


Or - you could use Django and whip something up really fast - just use their template engine, and you get all the menues, header, footer, etc, and replace the content with a big block of HTML pulled straight from the DB.


That's very much like Blatter: http://bitbucket.org/jek/blatter/src/


I've started using Sinatra for small websites. Its not a static-site generator but it does give me pretty simple control over layout and I can do some dynamic things if I wish.



That's what prompted me to ask the question. Have you used it? What do you think?

Going on what I've seen so far, I think Jeykll might be the best choice.



rest2web: http://www.voidspace.org.uk/python/rest2web/

It is not very flexible, but doesn't take very much effort either.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: