Bersosial.com: Indonesian Community

The desire to create a community for Indonesian finally realized, in December 2012 I set up a forum Bersosial.com using Drupal and was getting a good response that can be seen from the many visitors who come.

Currently, its global Alexa ranking reach to 50 thousands, and entered the top 500 sites in Indonesia, quite impressive for 5 months old forum. If you are an Indonesian, you can register now here.

Comment Fragment: Rewrite and Redirect Comment Permalink

A few days ago I releasing new module to rewrite and redirect the comment permalink to use a fragment for SEO purposes. The default Drupal 7 comment permalink has the following format, www.example.com/comment/1#comment-1, if a node has 10 comments, each page with the URL /comment/[comment-id] loads identical content to the node itself.

10 comments is fine but how about 1000 comments? 1000 duplicate contents is very bad for SEO and our website may be the target of Google's sandbox. To resolve this issues than I rewrite the comment URLs to www.example.com/node/[nid]#[comment-id] or www.example.com/[pathalias]#[comment-id] than redirect the old URL format to new format.

This module name is Comment Fragment, visit module project page here.

Check if checkbox field is checked (Drupal 7 theming)

Recently, I need the following features for one of client Drupal 7 site:

There is one content type that requires option to change the layout just by using checkbox, what is needed is an inline CSS that are added automatically if the checkbox is checked, so the CSS is added to node.tpl.php directly.

Checkbox created using Field module, the Boolean. Here's the code that I add:

<?php if (!empty($content['field_boolean']['#items'][0]['value']) == '1'): ?>
    <style type="text/css">
      // some css style here...
    </style>
<?php endif; ?>

Change the field_boolean with your field name.

Embed a view inside a node in Drupal 7

We can embed a view created by Views module inside a node in Drupal 7 with just some short code. Here is the code:

<?php
    $view = views_get_view('your_view_name');
    $view->set_display('your_view_display_name');
    $output = $view->preview();
    // now print the view.
    if ($view->result) {
        print views_embed_view('your_view_name', $display_id = 'your_view_display_name');
    }
?>

Just put that in your node.tpl.php, and don't forget to change the views name and display name with yours.

Just switch to using Disqus

Previously I was using Blogger default commenting system, and recently I decided to switch using Disqus. I did this in order to have more organized comments, and it seems Disqus protection from spammers are also much better.

Previously I remove all of the comments, a lot of comments are just spam, so this is a perfect moment to put up new platform for this blog commenting system.

No significant change in the loading speed of this blog, and I think this is the best solution I have now.