Dedecms realizes the principle of completely randomly calling different articles

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

People who used to weave dreams know that dream-woven CMS is very suitable for information stations, the generation of static Web pages, a small virtual host can pull tens of thousands of IP information station, which is the benefits of static Web pages, only occupy bandwidth, and virtual host sharing bandwidth allows you to use sufficient bandwidth.

However, after the static Web page is generated, the title of the article called in the Web page will be fixed, such as the recommended articles, recently updated articles, while the updated Web page calls the article title is the same, which makes it easy for search engines to find recommended articles, recently updated articles, which included this part of the page; if it's a long updated article, There is no chance to let search engines again found, not previously included, now also not included.

In order to solve this problem, we can use the method of random call to achieve the method of random call the article is very simple, random from a column or whole station to call a specified number of articles, and then randomly sorted. Among them, typeID represents the number of columns Id,row to call, Titlelen represents the length of the title, order by means of the collation, where Rand is random.

{dede:arclist typeid= ' 2 ' row= ' titlelen= ' orderby= ' Rand '} [Field:pubdate runphp= ' yes '] $a = ""; $b = ""; $c =strftime ("%m/%d", "@me"); $ntime = time (); $oneday = 3600 * 24; if ($ntime-@me) < $oneday) @me = $a. $c. else @me = $c; [/field:pubdate] [field:title/] {/dede:arclist}

The above code can be implemented randomly call the article title. However, all pages that are simultaneously updated are available randomly, in simple terms, all the random pages of the results are the same, is 12 of the same article title, but the order of the following is different, like a Web page to call out the sequence is: article A, article B, article C, and another page call out the order is: article C, Article A, article B.

For search engines, this random call out of the article title does not make much sense, or can not let search engines find more articles; If your site weight is not high enough, search engines do not have so much time in accordance with the "previous, next" article in the order to crawl your article, So to make each page randomly call out the article title is different, so that more pages have the opportunity to be crawled by search engines.

To achieve a real random call, we can consider this, the first random call 10,000 pages, for the same time update the Web page, the random call to the 10,000 articles, but the sorting is different, since the order is different, we take the top 12 articles can be, This allows you to truly implement random calls to 12 article titles. Here is the code that implements a completely random invocation of the article.

{dede:arclist typeid= ' 2 ' row= ' titlelen= ' orderby= ' Rand '} [Field:pubdate runphp= ' yes '] $a = ""; $b = ""; $c =strftime ("%m/%d", "@me"); $ntime = time (); $oneday = 3600 * 24; if ($ntime-@me) < $oneday) @me = $a. $c. else @me = $c; [/field:pubdate] [field:title/] {/dede:arclist}

The above typeID said column, column ID 2, if not restricted columns, the whole station random call, then the 2 modified to Rand can; pagesize this label originally appears on the list page, sorted by rule on the list page articles, and placed in the content page position, also valid. These tests are available in Dedecms v5.6 and version 5.7, and for earlier versions, no tests have been done and it is not clear if they are effective.

{dede:arclist typeid= ' 2 ' row= ' 10000 ' pagesize= ' of ' titlelen= ' orderby= ' Rand '} [Field:pubdate runphp= ' yes '] $a = ""; $b = ""; $c =strftime ("%m/%d", "@me"); $ntime = time (); $oneday = 3600 * 24; if ($ntime-@me) < $oneday) @me = $a. $c. else @me = $c; [/field:pubdate] [field:title/] {/dede:arclist}

We can further implement typeID random calls, the implementation of each page is randomly called to different articles, the number of your article, you can set the value of row to the larger, so that the total station update, the random call to the results will be richer; In addition, we suggest that a Web page has a random call to the area of the article, There are also recommended articles, related articles, so that the search engine found that you recommend the article at the same time, found that some of the old articles, so that the site included a higher rate. This article is provided by the Taobao Women's Clothing (http://www.121h.com), the effect of random call article can go to my website to see, Welcome to reprint share articles, please keep the author link, thank you!

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.