3.0.X版本修改首页SEO标题方法

spendl
spendl This guy is lazy,Introduction has not been set

10 People liked this article · 5236 views

有个哥们发私信说我以前的修改方法用不了,我研究了一下。。。。 现在的版本的修改如下: 路径:\views\default\global\header_meta.tpl.htm 
  <title><?php echo $this->page_title; ?></title>
把上面的代码删除 如果网站没有开分类,添加下面的代码。
<?php if (!$this->user_id) { ?>
<?php if (!$_GET['app'] OR $_GET['app'] == 'explore') { ?>
<title><?php echo $this->page_title; ?> - 这里是没有登陆时首页显示的内容,针对搜索引擎</title>
<?php } else { ?>
<title><?php echo $this->page_title; ?> - 这里是没有登陆时除首页外,其他页面显示的内容,针对搜索引擎</title>
<?php } ?>
<?php } else { ?>
<title><?php echo $this->page_title; ?> - 这里是登陆之后显示的内容,针对用户</title>
<?php } ?>


如果网站开分类,添加下面的代码。
 <?php if (!$this->user_id) { ?>
<?php if (!$_GET['app'] OR $_GET['app'] == 'explore') { ?>
<?php if (!$_GET['category']) { ?>
<title><?php echo $this->page_title; ?> - 这里是没有登陆时首页显示的内容,针对搜索引擎</title>
<?php } else { ?>
<title><?php echo $this->page_title; ?> - 这里是没有登陆时除首页外,其他页面显示的内容,针对搜索引擎</title>
<?php } ?>
<?php } else { ?>
<title><?php echo $this->page_title; ?> - 这里是没有登陆时除首页外,其他页面显示的内容,针对搜索引擎</title>
<?php } ?>
<?php } else { ?>
<title><?php echo $this->page_title; ?> - 这里是登陆之后显示的内容,针对用户</title>
<?php } ?>

Published on 2015-01-18 20:32

Disclaimers:

This document is written by spendl Original published on WeCenter ,The copyright belongs to the author。

Log in,More exciting content waiting for you to find,Contribute wonderful answers,Participate in comment interaction

go Sign in! No accountgoregister

亲测答案
2017-03-13 17:04
这个方法不错
亲测答案
2017-03-12 11:10
楼上的方法不错
a279257725
2015-05-30 23:09
不好意思,我的版本是3.1.2,所以没弄好。可以用的,3.1.2用下面代码 <?php if (!$this->user_id) { ?> <?php if (!$_GET['app'] OR $_GET['app'] == 'explore') { ?> <title><?php echo $this->page_title; ?>-SEO关键词往这里填!</title> <?php } else { ?> <title><?php echo $this->page_title; ?></title> <?php } ?> <?php } else { ?> <title><?php echo $this->page_title; ?></title> <?php } ?>
a279257725
2015-05-30 22:03
你确定你这个代码能用?判断是不是首页,你判断user_id有什么用?搜索引擎肯定不会登陆。 现在目标是修改首页title,其他页面title不会跟着变,要判断的是首页。你这个代码根本不起作用,自己测试能用了再发好吗?
圣笔创意工作室
2015-05-27 11:31
首页网站标题前面的 发现怎么去除啊
spendl
2015-02-14 23:25
3.1没有研究过啊,你研究一下咯,行不行都来这里报告一下。。。
mpower
2015-02-13 09:24
标记下。。。。。。。。。。。。。。
pcdhacker
2015-02-10 14:02
这个适合3.1吗???
547082950
2015-01-20 12:51
非常感谢了
spendl
2015-01-19 22:03
可以了,用了最笨的方法,代码虽然多了点,将就能用吧。
All Rights Reserved Powered BY WeCenter V4.1.0 © 2023 粤ICP备17116736号