Results 1 to 2 of 2

Thread: Small hack to use h1 tags on post page for SEO

  1. #1
    Admin & Design JonH's Avatar
    Join Date
    Jun 2009
    Location
    New Braunfels, Texas
    Posts
    248
    Thanks
    57
    Thanked 49 Times in 30 Posts

    Default Small hack to use h1 tags on post page for SEO

    Here's a way to switch the <h1> tag to the post or "story" link title on post pages - which should help with SEO. The example is using the default theme. There might be a better way for CSS than my hack but you get the idea to use the <h1> tag on post link titles.

    Open up content/themes/default/header.php and find: <!-- TITLE & AD BLOCKS -->
    and replace
    PHP Code:
          <div id="hd_title">
          <a href="<?php echo BASEURL?>"><?php echo SITE_NAME?></a>
          </div>
    with

    PHP Code:
            <div id="hd_title">
            <?php    if ($h->pageType == 'post') { ?>
            <h2><a href="<?php echo BASEURL?>"><?php echo SITE_NAME?></a></h2>
            <?php } else { ?>    
            <h1><a href="<?php echo BASEURL?>"><?php echo SITE_NAME?></a></h1>
            <?php ?>
            </div>
    ..CSS edit
    Open up content/themes/default/style.css and under
    Code:
    #hd_title h1 a:hover { color: #000; }
    add
    Code:
    #hd_title h2 { font-size: 2.2em; font-weight: bold; padding: 0.5em 0.4em 0.4em 0.4em;}
    #hd_title h2 a { color: #666; }
    #hd_title h2 a:hover { color: #000; }
    ...so the post titles are styled the same on the list and post pages.

    Open content/plugins/sb_base/templates/sb_post.php.

    Find and replace lines 48 thru 50:
    PHP Code:
                <a href='<?php echo $h->post->origUrl?><?php echo $h->vars['target']; ?> class="click_to_source"><?php echo $h->post->title?></a>
            <?php } else { ?>
                <?php echo $h->post->title?>
    with: (just adding <h1> tags to link titles)
    PHP Code:
                <h1><a href='<?php echo $h->post->origUrl?><?php echo $h->vars['target']; ?> class="click_to_source"><?php echo $h->post->title?></a></h1>
            <?php } else { ?>
                <h1><?php echo $h->post->title?></h1>
    Open content/plugins/sb_base/templates/sb_list.php

    Find lines 49 thru 51 and replace:
    PHP Code:
                    <a href='<?php echo $h->post->origUrl?><?php echo $h->vars['target']; ?> class="click_to_source"><?php echo $h->post->title?></a>
                <?php } else { ?>
                    <a href='<?php echo $h->url(array('page'=>$h->post->id)); ?><?php echo $h->vars['target']; ?> class="click_to_post"><?php echo $h->post->title?></a>
    with: (just adding <h2> tags)
    PHP Code:
                    <h2><a href='<?php echo $h->post->origUrl?><?php echo $h->vars['target']; ?> class="click_to_source"><?php echo $h->post->title?></a></h2>
                <?php } else { ?>
                    <h2><a href='<?php echo $h->url(array('page'=>$h->post->id)); ?><?php echo $h->vars['target']; ?> class="click_to_post"><?php echo $h->post->title?></a></h2>
    ...CSS edit
    Open the css for the sb_base plugin /content/plugins/sb_base/css/sb_base.css

    Find and replace:
    Code:
    .show_post_title { font-size: 1.2em; font-weight: bold; }
    With:
    Code:
    .show_post_title h1{ font-size: 1.2em; font-weight: bold; }
    .show_post_title h2{ font-size: 1.2em; font-weight: bold; }
    Now your site name should have <h1> tags on the home and sort pages with post link titles tagged with <h2>... Single story "post" pages these will be swapped so the title link will have the <h1> tags.

  2. Thanked by:


  3. #2
    Design & Development carlo75's Avatar
    Join Date
    Oct 2009
    Location
    Italy - Perugia
    Posts
    509
    Thanks
    62
    Thanked 105 Times in 58 Posts

    Default

    SEO improvements are always welcome... thank you JonH

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. HACK: Adding Nicedit WYSIWYG Editor to the Comment Form
    By nothingman in forum How-To and Troubleshooting
    Replies: 8
    Last Post: 05-20-2013, 08:20 PM
  2. Tags 1.8
    By Nick in forum Plugin Downloads
    Replies: 20
    Last Post: 03-09-2011, 08:57 PM
  3. TinyMCE in Submit Step 2: Small help needed
    By nothingman in forum How-To and Troubleshooting
    Replies: 18
    Last Post: 12-01-2010, 08:14 AM
  4. Mini hack for URL submission
    By newbieone in forum How-To and Troubleshooting
    Replies: 2
    Last Post: 01-28-2010, 12:21 AM
  5. Retrieve name of Edit Post page
    By carlo75 in forum How-To and Troubleshooting
    Replies: 2
    Last Post: 01-12-2010, 03:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •