首页 > WORK > 在每篇文章后添加Google Adsense

在每篇文章后添加Google Adsense

版权声明:本文可以任意转载,转载时请务必以超链接形式标明文章原始出处作者署名本版权声明

前两天把Google Adsense的显示方式改了,原来是在首页的侧边栏部分显示,现在改为在每篇文章的下方显示,一来关键字的匹配度可能会好一些,二来也醒目一些。

修改过程中利用了flex模块的功能,可以任意调整区块的显示位置,可定制性强,也很方便,然后在我使用的theme下修改node内容文件,把相关显示代码加入到相应的位置就行了。

    <div class="node<?php if ($sticky) { print " sticky"; } ?>">
    <?php if ($picture) {
      print $picture;
    }?>
    <h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2>
    <span class="submitted"><?php print $submitted?></span>
    <span class="taxonomy"><?php print $terms?></span>
    <div class="content"><?php print $content?></div>

    <?php $blocks = theme(’flexiblock_blocks’, 2); ?>
    <?php foreach ( $blocks as $block ) { ?>
    <?php echo $block['content'] ?>
    <?php } ?>

    <div class="links">&raquo; <?php print $links?></div>
    <div class="clear"></div>

    </div>

我是把它放入了文章主体内容的后面,也就是上面的“content”后面。如果显示效果不满意的话,可以再加上自定义的CSS,因为Google Adsense的颜色大小都是可以选择的,我这里就没有再加上额外的CSS了。

后面打算继续用这种方式加上tag相关文章的功能。

PS:除了新发的还未被Google收录的文章外,已被收录文章的关键字匹配度真是越来越好,比半年多前Google Adsense刚出来的时候强得太多,可能也是在Google投放广告的客户越来越多了吧。

分类: WORK 标签:
  1. 本文目前尚无任何评论.