The method of dedecms dream weaving automatic internal chain, the solution to the failure of automatic internal chain weaving dream

Internal links are very important in seo website optimization. As long as you do seo, there must be internal links in the article, but if each article is manually set, it will be very laborious. For lazy people, you want Optimizing and not wanting to be so tired, in fact, dream weaving itself has the function of automatic internal chaining. There are many tutorials on the Internet, and many of them were unsuccessful. However, Huangtian paid off, and finally found a solution after tossing.

The setting method of the automatic internal chain function of dedecms is as follows

1. "System"-"System Basic Parameters"-"Core Settings"-"Keyword Replacement (Yes/No)" set it to "Yes"

2. "System"-"System basic parameters"-"Other options"-"Automatically extract keywords" set it to "No"

3. "System"-"System basic parameters"-"Other options"-"Keyword replacement times (0 means all replacement)" set it to "1"

4. "Core"-"Batch Maintenance"-"Document Keyword Maintenance"

So far, the automatic inner chain of dedecms dream weaving is set up, but this is unsuccessful, and the following changes are needed.

Open /include/arc.archives.class.php and find: version_compare(PHP_VERSION, '5.5.0' Use a text editor to batch replace with: version_compare(PHP_VERSION, '7.5.0'

In this way, the dedecms dream weaving automatic internal chain is completely set up, and I personally tested it successfully!

Note: Modification frequency is 1      frequency: it is the number of links added in your article. (For example, an article contains 3 same internal chain keywords, only add a link to one of the keywords)

Dedecms dream weaving automatic internal chain method

 

1. The problem of inner chain nesting caused by automatic inner chain repeated replacement of dedecms,

Modify the code method:

Find the file include/arc.archives.class.php, at line 1246 of code, as follows:

//Highlighting only, it may not reach the most times if you replace it many times

function _highlight($string, $words, $result, $pre)

{

    global $cfg_replace_num;

    if (version_compare(PHP_VERSION, '5.5.0', '>='))

    {

        $string = $string[0];

        $ pre = $ pre [0];

    }

    $string = str_replace('\"','"', $string);  

Add the following code after it:

uasort($words,create_function('$a, $b','return strlen($a)>strlen( $b);'));

2. The problem of the keyword priority of the automatic internal chain of dream weaving dedecms

DedeCMS automatic internal chain will give priority to the use of short keywords, such as "long words", "I am a big long words", "small long words", which appear in an article at the same time, the program will use the long words in order -Small long words-I am a big long words.

Keyword internal chain opening steps

Background-System-Core Settings-Keyword Replacement [Yes]

Background-System-Other Options-Keyword Replacement Times [1]

Ways to solve the problem of keyword length priority

Open /include/arc.archives.class.php to find

$query = "SELECT * FROM #@__keywords WHERE rpurl<>'' ORDER BY rank DESC";

Change to

$query = "SELECT char_length(keyword) AS num,aid,keyword,rpurl,rank FROM #@__keywords WHERE rpurl<>'' ORDER BY num DESC";

Keep finding

"#".preg_quote($word)."#"

Change to

"#(?<!>)(?!<)".preg_quote($word)."#"

final effect

I am a big long poem, a small long poem, a long poem

You may also need  a solution where one keyword corresponds to multiple links automatically in the dream weaving

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_39339179/article/details/110085800