Jump to Navigation

Creating a poor man's blog

Sometimes you have to write your own Drupal modules. Sometimes you need some heavy weight module. But often, you can fit several smaller modules together to get what you want.

In this case, I wanted to create a small blog. The blog entries should be available as /blog/1, /blog/2, etc. A small pager should allow you to go to previous and next pages. Sounds easy? One option is to use the built-in  core blog module, but this is more suited for a site with multiple blogs by different users. I decided on a different route.

The pathauto module can automatically generate URLs. But how to get the correct blog number? The serial module can do that for you: it adds a field that automatically contains a sequence number, based on the node date. It is limited to do this per node type, but as my blog entries are a separate node type, this will work out beautifully. The token module supplies the glue that is needed between these two modules.

One option for the pager is the flippy module. Again, it sets this for a specific node type, which is exactly what I need. You can even, again using the token module, display the title or any other component of the previous and next nodes.

The pathauto and token module are useful for almost any Drupal site and highly recommended. The other two solve my particular requirements. You can see the result on this site!



Blog_article | by Dr. Radut