Php displays different content to visitors and crawlers. I have heard that this method violates some search engine operating principles and may be penalized by various search engines or even deleted from websites. so I have just removed this kind of processing until I confirm that it is not heard that this method violates some of the search engine's operational principles and may be punished by various search engines or even deleted from the website. so I have just removed this process until I confirm that it is not cheating. if you have the courage to continue using the service, you are at your own risk.
The homepage and archive page of this blog displays articles in the form of a list. only the content of the article is loaded when a visitor clicks to expand the article. because the content of the article contains a lot of text and images, it requires a lot of loading time and traffic. displaying webpages to visitors as soon as possible can retain a large number of visitors. for mobile phone users, loading time and traffic are more important.
In general, the homepage of a website is the most visited page by the search engine. you should try to show meaningful content to it, but to display the article in the form of a list, visitors and search engines can only obtain the title information of an article. the content or abstract of the article (especially the first sentence) is extremely important for SEO, so we should try to send the content to crawlers.
Well, we can use the User Agent to determine whether the visitor is a crawler. If yes, the document will be displayed in the general form; otherwise, the document list will be displayed in the form of a list. you can use the following PHP method to determine whether a crawler is used:
The code is as follows:
Function is_crawler (){
$ UserAgent = strtolower ($ _ SERVER ['http _ USER_AGENT ']);
$ Spiders = array (
'Googlebot ', // Google crawler
'Baidider Ider ', // Baidu crawler
'Yahoo! Slurp ', // Yahoo crawler
'Yodaobot ', // Youdao crawler
'Msnbot '// Bing crawler
// More crawler keywords
);
Foreach ($ spiders as $ spider ){
$ Spider = strtolower ($ spider );
If (strpos ($ userAgent, $ spider )! = False ){
Return true;
}
}
Return false;
}
This is my method. crawlers sort access comments from high to low, and then use the following method to display different content to crawlers and natural persons.
The website may be penalized by various search engines or even deleted from the website. so I have just removed this process until I confirm that it does not belong...