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