Phpcms V9 two ways to set up the page title of a manuscript

Source: Internet
Author: User
Phpcms V9 article page header two ways to set up
Today, one of my Phpcms site content page included, found that the content page paging title are repeated the same, but this is not conducive to SEO optimization. In the Baidu collection saw just received several content pages are repeating title mark, all is Phpcms v9 program pagination duplicate title caused. is not conducive to SEO optimization, and then want to add a number of pages in the title. The file at the top of the website was randomly added "{$page}", and the generated article was tested. Yes, the effect came out. All the pages of the title are added "" "", but browse to the list page and no pagination of the article, ' "" "Page" or "" "space has been shown, look very bad, how to not show the title of the page is not the ugly box, tossing for a long time, with an if statement to fix.

The first method: Modify the template

In Phpcms v9 backstage, interface--template style--detailed list--content---modify header.html file, in <title></title>Just add the next line of code.

{if ($page) > (1)} "{$page}" {/if}

When the article is not paged, "1" "no longer appear

Second method: Modify the System

Locate the phpcms\modules\content\classes\html.class.php file, class approximately 160 lines:


After this code, add the following code to OK

Start   if ($page!=1) {   $title 1 = $title. ". $page." Page ";   } else{   $title 1 = $title;   }   $SEO = SEO ($siteid, $catid, $title 1, $description, $seo _keywords);                    End

Note, the above modification method will cause pagination if you use sub-headings, the sub-headings will appear after the first page, the rule is: sub-title + paging number, if you do not want, you can modify the 86 line:
$title = Strip_tags ($title);

Add in the following:

$orgtitle = $title;  Save the title in a variable find about 133 lines of foreach ($pageurls as $page + = $urls) Add the following code to OK. Start  modifies the title to display the number of pages of the caption   if ($page!=1) {   $title 1 = $orgtitle. ". $page." Page ";   } else{   $title 1 = $orgtitle;   }   $SEO = SEO ($siteid, $catid, $title 1, $description, $seo _keywords);                    End



  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.