Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Customizing how your blogs are displayed is extremely easy in Drupal using a phptemplate based theme. All you need to do is:
- Make a copy of your node.tpl.php file
- Rename it to node-blog.tpl.php
- in a text editor like notepad.exe or equivalent, edit the layout to suit your needs and upload it to your active theme folder
- Drupal will automatically pick up your new node-blog.tpl.php layout file and apply it
Available variables
- $title : Title of node.
- $node_url : Link to node.
- $terms : HTML for taxonomy terms.
- $name : Formatted name of author.
- $date : Formatted creation date.
- $sticky : True if the node is sticky on the front page.
- $picture : HTML for user picture, if enabled.
- $content : Node content, teaser if it is a summary.
- $links : Node links.
- $taxonomy (array) : array of HTML links for taxonomy terms.
- $node (object) : The node object.
- $main : True if the node is appearing in a context, like the front page, where only the teaser should be shown.
- $page : True if the node is being displayed by itself as a page.
- $submitted : Translated text, if the node info display is enabled for this node type.
Default template
<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<?php if ($page == 0): ?>
<h2><a href="/<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php print $picture ?>
<div class="info"><?php print $submitted ?><span class="terms"><?php print $terms ?></span></div>
<div class="content">
<?php print $content ?>
</div>
<?php if ($links): ?>
<?php if ($picture): ?>
<br class='clear' />
<?php endif; ?>
<div class="links"><?php print $links ?></div>
<?php endif; ?>
</div>