At the bottom of every blog node, there's a link for "author's blog" | "comments" -

It seems that drupal just prints "links" but there's no way to say, only output this link, and not this one...how do i customize this? I only want "add comment" to be there. Do i have to hack the link module?

I'm hoping someone can point me to links, i'm sure people have faced this before.
Thanks,

Comments

varunvnair’s picture

Possible options at your disposal:

  • If you are using Drupal for running a single person blog then simply use the 'page' nodetype to make posts. The blog nodetype does not give you any significant functionality in this scenario. Regarding the already existing posts you can simply change the 'type' field in 'node' table to page. I have done this on my local test installation and will soon make the changes to my online blog.
  • Assuming your theme is phpTemplate based you can create your own template for your node type. You can sensibly hardcode the links you want in that template. In this case you should not print $links at all. You can also cycle through $links contents and explicitly not print stuff you don't want printed. This ensures that the template is futureproof to some extent since links added by newly added modules will still appear.
  • Comment out blog_link() function in blog.module so that "author's blog" link is not added to $links.

I faced a similar problem sometime back and my limited research showed that there was no clean way to control the contents of $links.

Hope this helps. Do let us know what you finally did.

luyendao’s picture

Hi Varun,

Thanks for your exhaustive post, i appreciate your time and effort. IThe first and third option sound like the easiest to implement.

As much as I like Drupal, i wish more of these fine-grain rendering things were not at the code level, but at a .properties or xml layer, where they're more easily editable!

Lu

tarek’s picture

Hey all!

With regards to these links, I also had this problem, and came up with the following work-around. In my case, I simply did not want "blog_links" to display. The same tactic can be used to add other links as desired.

   <?php if ($links): 
	unset ($links);
	$links = theme_links(comment_link('node', $node, $teaser));?>
      <div class="links"><?php print $links; ?></div>
    <?php endif; ?>

tarek : )

usonian’s picture

Tarek's solution almost worked for me, but then I realized that I would lose the links generated by the print and forward modules. While poking through the blog.module code, it occurred to me that all I had to do was override theme_links in my theme's template.php file. For instance, if my theme's name was 'foo', I could do like so:

function foo_links($links, $attributes = array('class' => 'links')) {

/* Get rid of the "so-and-so's blog" links */
unset($links['blog_usernames_blog']);

return theme_links($links, $attributes);

}

seanr’s picture

Gotta love it when a fellow Frank Lloyd Wright fan mentions one of my modules on my birthday. ;-)

I'm actually having problems getting comment_link to output anything at all and it's driving me nuts. Trying to use it in a views theme (views-list-exchange_promoted.tpl.php):

<!--
<?php print_r(theme_links(comment_link('node', $node, TRUE))); ?>
-->

Just outputs:

<!--
-->

Sean Robertson
webolutionary@webolutionary.com