HI, today I will talk about your most concerned problem, the SEO function of the theme, zblog One of the most popular plug-ins is the SEO plug-in. At first, I didn't know much about it, so I didn't touch it at first. But later, I got to know more about SEO and related knowledge. Referring to the existing specifications of SEO plug-ins and search engine titles, the theme template was directly prepared SEO optimization No matter the homepage, category or article, you can customize SEO information. I think that you can reduce your dependence on plug-ins. However, I am still too young.
In the past six months, several netizens have reported that they have been using SEO plug-ins for a long time, and the theme is incompatible, so what they have included before may cause punishment. After all, even the title may not be right, so what should we do? At the beginning, I didn't understand that those children's shoes that thought SEO was awesome didn't follow the specifications, they had to follow their own writing, for example, the specification of article page title was“ Article name category name website name ”But he wrote it for you“ Article Name ”Another part is“ Article Name | Site Name ”Well, it is uneven, but recently I thought that it might have been used all the time. The weight has been included. If you change the SEO title, the previous efforts may be in vain. So today I will teach you how to solve the problem of incompatible themes with SEO plug-ins.
Cut the crap and find your theme template“ header.php ”Template, based on this site“ accomplish sth. lasting by leading a quiet life ”For example, find the theme template path“ /zb_users/theme/quietlee/template/ ”Edit“ header.php ”After finding the template, we will find the code as shown in the figure:
These are SEO title information of homepage classification, articles and other templates Because the plug-in conflicts with these codes, there is nothing after the SEO plug-in is opened, and the website is directly displayed. Then we just need to delete these codes. Take the figure as an example, find“ {if $type==xxx} ”To {else} and {/if} End, as shown in the figure:
The code starts to end, {if $type==xxx} -{/if} To prevent deletion errors, find {else} The first one below {/if} Label, delete. If you still don't understand, follow In the following, for example, this code means to judge each template page. The code is as follows:
{if $type=='article '} Judgment Article page SEO {elseif $type=='page'} Article single page SEO {elseif $type=='index'} Homepage SEO {else} Other pages SEO (tags, searches, users, etc.) {/if}
You should be clear this time, right? from {if} starts to {/if} ends , delete , and then to prevent errors, we paste the following code after deleting the code:
<title>{if $type=='article' || $type=='page'}{$title}-{$name}{else}{$name}-{$title}{/if}</title>
Then save the code, return to the background home page, and click Clear cache and compile template , the foreground view effect. The same sentence, Remember to backup before modifying , The PHP file cannot be used for txt text editing, otherwise an error will occur.