↑ Return to Y20 Post Links

PRIV Y23 External Post Links


Page no: Y23

Replace External Article Links by Links to Syndicated Content

problem

The most important syndication tool is the replacement of external links into internal links. When David Andalfatto talks about an article by Noah Smith, then he will link Noah’s page on Noah’s blog.

Unfortunately this link is outside of our site and we risk to lose traffic and google points.  But we have syndicated Noah’s blog entry on our site.

Solution Idea

With our syndication plugin, we have stored also the original external link in a meta attribute. So we have a mapping from internal page/link to external link (in meta).

Now we should replace the external links with internal ones.

 

Selection of posts and pages

See this page for the GUI and selection of posts and pages.

 

Make the chunk process

The “chunk process” is the loop through all posts, pages and books that got selected in the GUI.
There is an “inner loop” that goes through all posts and pages and find out, if we can replace an external with an internal link.
During this operation we load a selected chunk of items.

 

We prepare the real execution of the changing. After the first step, here we have the number of the internal links in this article, which can be replaced. This task is for the real execution of the prepared links.

 

Make the replace

Once a link is found, we must start the replace. We use the command “preg_replace”.  The code for the replace looks as follows:

Here we prepare the content of the article to get all of the URLs from the article and search for similar link into Original Link field (wp posts meta)

Statistics

Then we have to check how much URLs are changed and to give back the stats to the GUI.

Improvements

 

Create original external links.

Explanation appears after user chooses function.
“This procedure creates the original external links out of the feed-based link.”

Output fields:
Postname PostDate external link feed link

Create original external link
Title, Date, Old and New link Create original external link

Prepare the code for preg_replace

Here we prepare the content of the article to get all of the URLs from the article and search for similar link into Original Link field (wp posts meta)

Make the chunk process

We prepare the real execution of the changing. After the first step, here we have the number of the internal links in this article, which can be replaced. This task is for the real execution of the prepared links.

See more for sYndication Tools