Home Backend Development PHP Tutorial PHPCMS V9稿子分页标题设置的两种方法

PHPCMS V9稿子分页标题设置的两种方法

Jun 13, 2016 am 10:29 AM
page phpcms seo title

PHPCMS V9文章分页标题设置的两种方法
今天我的一个phpcms网站内容页收录了,发现内容页分页的标题都是重复一样的,但是这样是不利于seo优化的。在百度收录看到刚收的几个内容页都是重复标题标记,全是phpcms v9程序分页重复标题造成的。很不利于seo优化,于是想着在标题里加入分页数。在网站顶部文件随便加了个【{$page}】,生成文章测试 了下。不错,效果出来了。所有分页的标题都加上了“【分页数】”,可是浏览到列表页和没有分页的文章里,‘【分页数】或“【】”空格一直显示着,看着很不顺眼,怎样在无分页的标题上不显示那难看的框框呢,折腾了半天,用了一个if语句搞定。

第一种方法:修改模版

  在phpcms v9后台,界面--模板风格--详细列表--content---修改header.html文件,在

之间加入下一句代码就行了

{if ($page) > (1)}【{$page}】{/if}
Copy after login

  当文章无分页的时候,“【1】”再不出出现了

第二种方法:修改系统

  找到phpcms\modules\content\classes\html.class.php文件,类约160行:

$pagefile = PHPCMS_PATH.$pagefile; 
Copy after login

  在这段代码之后添加如下代码就OK

//start   if($page!=1){   $title1 = $title." 第".$page."页";   }else{   $title1 = $title;   }   $SEO = seo($siteid, $catid, $title1, $description, $seo_keywords);                    //end
Copy after login

  备注,上面的修改方法会导致分页的如果使用子标题,则子标题会显示在第一页过后,规则为:子标题+分页号码,如果不想,可以这么修改86行:
$title = strip_tags($title);
Copy after login

  在后面添加:

$orgtitle = $title;  //将标题保存在一个变量中  找到大约133行foreach ($pageurls as $page=>$urls)   添加以下代码就OK了。//start  修改标题显示标题的页数   if($page!=1){   $title1 = $orgtitle." 第".$page."页";   }else{   $title1 = $orgtitle;   }   $SEO = seo($siteid, $catid, $title1, $description, $seo_keywords);                    //end
Copy after login



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Vue3+TS+Vite development skills: how to optimize SEO Vue3+TS+Vite development skills: how to optimize SEO Sep 10, 2023 pm 07:33 PM

Vue3+TS+Vite development skills: How to perform SEO optimization SEO (SearchEngineOptimization) refers to optimizing the structure, content and keywords of the website to rank it higher in search engines, thereby increasing the website's traffic and exposure. . In the development of modern front-end technologies such as Vue3+TS+Vite, how to optimize SEO is a very important issue. This article will introduce some Vue3+TS+Vite development techniques and methods to help

Summary of Vue development experience: Practice in solving SEO and search engine optimization Summary of Vue development experience: Practice in solving SEO and search engine optimization Nov 22, 2023 am 08:44 AM

Summary of Vue development experience: Practice in solving SEO and search engine optimization In the current era of rapid development of mobile Internet and Web technology, search engines are still one of the most important ways to obtain information on the Internet. For websites that need to gain high exposure in search engines, SEO (SearchEngineOptimization) is an essential task. So, for web development projects using Vue technology, how to achieve SEO and search engine optimization? Vue

How Vue performs SEO optimization and practical suggestions How Vue performs SEO optimization and practical suggestions Jun 09, 2023 pm 04:13 PM

With the continuous development of web technology, more and more websites are beginning to use Vue as the front-end framework. Although Vue can provide a good user experience and development efficiency, there are still some challenges in search engine optimization. This article will introduce how Vue performs SEO optimization and some practical suggestions. 1. Vue’s SEO issues Vue’s SEO issues mainly include the following points: Server-side rendering issues: Vue is a single-page application (SPA), which means that it is rendered in the browser through JavaScript

SSR technology application practice in Vue 3 to improve the SEO effect of the application SSR technology application practice in Vue 3 to improve the SEO effect of the application Sep 08, 2023 pm 12:15 PM

SSR technology application practice in Vue3 to improve the SEO effect of applications. With the rapid development of front-end development, SPA (Single Page Application) has become mainstream. The benefits of SPA are self-evident and can provide a smooth user experience, but there are some challenges in terms of SEO (search engine optimization). Since SPA only returns an HTML template in the front-end rendering stage, most of the content is dynamically loaded through JavaScript, causing search engines to have difficulties in crawling, indexing, and ranking. To solve this problem,

What is the difference between SEO and SEM What is the difference between SEO and SEM Aug 10, 2023 pm 03:48 PM

The difference between SEO and SEM is 1. SEO refers to search engine optimization, while SEM refers to search engine marketing; 2. SEO optimizes the visibility of the website so that it naturally ranks in front of organic search results, while SEM uses advertising to Paid ranking at the top of search results; 3. SEO is a long-term strategy, which requires continuous and sustained efforts to maintain the website's ranking in search engines, while SEM can be flexibly adjusted and implemented, and it can quickly adjust the advertising strategy as needed. and budget.

How to jump to the details page in phpcms How to jump to the details page in phpcms Jul 27, 2023 pm 05:23 PM

How to jump to the details page in phpcms: 1. Use the header function to generate a jump link; 2. Loop through the content list; 3. Get the title and details page link of the content; 4. Generate a jump link.

What framework is phpcms? What framework is phpcms? Apr 20, 2024 pm 10:51 PM

PHP CMS is a PHP-based open source content management system for managing website content. Its features include ease of use, powerful functionality, scalability, high security, and free open source. It can save time, improve website quality, enhance collaboration and reduce development costs, and is widely used in various websites such as news websites, blogs, corporate websites, e-commerce websites and community forums.

Optimizing website SEO: practice of pseudo-static hiding php suffix Optimizing website SEO: practice of pseudo-static hiding php suffix Mar 07, 2024 pm 12:27 PM

As we all know, optimizing the SEO of a website is a very important part of website operation. The default URLs of dynamic web systems (such as PHP) used by many websites have extensions (.php, .html, etc.), which will affect the SEO effect of the website. In order to improve the optimization effect of the website, a common practice is to change the dynamic URL to a pseudo-static URL to hide the extension name and improve the user experience and search engine ranking of the website. This article will take "pseudo-static hidden php suffix" as the theme, introduce how to achieve this optimization in PHP websites, and

See all articles