typecho 获取本页地址,声明原创
- typecho 获取本地地址,声明原创
<ul> <li><a href="<?php $this->permalink(); ?>">除非注明,绿网博客文章均为原创,转载请以链接形式标明本文地址</a></li> <li>本文地址:<a href="<?php $this->permalink(); ?>" target="_blank"><?php $this->permalink(); ?></a></li> </ul>
<ul> <li><a href="<?php $this->permalink(); ?>">除非注明,绿网博客文章均为原创,转载请以链接形式标明本文地址</a></li> <li>本文地址:<a href="<?php $this->permalink(); ?>" target="_blank"><?php $this->permalink(); ?></a></li> </ul>
typecho做博客还是很好用的,为了seo,需要获取相关文章,如下:
Archive.php 里面有函数:默认按标签获取相关
//type支持传author和不传,不传代表按标签推荐相关
public function related($limit = 5, $type = NULL)
{
$type = strtolower($type);
switch ($type) {
case 'author':
/** 如果访问权限被设置为禁止,则tag会被置为空 */
return $this->widget('Widget_Contents_Related_Author',
array('cid' => $this->cid, 'type' => $this->type, 'author' => $this->author->uid, 'limit' => $limit));
default:
/** 如果访问权限被设置为禁止,则tag会被置为空 */
return $this->widget('Widget_Contents_Related',
array('cid' => $this->cid, 'type' => $this->type, 'tags' => $this->tags, 'limit' => $limit));
}
}
2.所以代码如下
<?php $this->related(5)->to($relatedPosts); ?>
<ul>
<?php while ($relatedPosts->next()): ?>
<li><a href="<?php $relatedPosts->permalink(); ?>" title="<?php $relatedPosts->title(); ?>"><?php $relatedPosts->title(); ?></a></li>
<?php endwhile; ?>
</ul>
1.首先找到域名配置文件,一般位于 /usr/local/nginx/conf/nginx.conf
找到 enable-php.conf
改成 enable-php-pathinfo.conf
2.加入 include typecho
include rewrite/typecho.conf
如果您看到这篇文章,表示您的 blog 已经安装成功.