Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

how to automatically link certain words to specified pages

+1 vote
asked Aug 17, 2011 in Q2A Core by OllieJames
I would like to automatically link certain words in the text of asked questions and the answers to specified pages.

I would think this perhaps requires a plugin which allows to specify the words and the connected pages and the maximum number of links per keyword within each page to be specified as well.

So for example if the word 'estimated crazy things' shows up the plugin automatically links it to http://www.yourdomain.com/estimated-crazy-things.html

It this word combination (estimated crazy things) shows up 7 times, I would have to be able to set the links to a limit of 2 per page, which then will be placed at random.

The plugin would also have to be able to deal with capitalised version of the keyword combination.

Anybody have any ideas how to go about this?

2 Answers

+1 vote
answered Aug 17, 2011 by gidgreen
You could do this with a layer (part of a plugin) which processes the HTML rendered content of posts, adding in the links to that HTML.
commented Aug 17, 2011 by OllieJames
Thanks Gideon,

Could you give me an example how to do this code wise?

0 votes
answered Aug 18, 2011 by NoahY

You could start with the embed plugin:


and just hard code the substitutions, or adapt it for database retrieval.  You could even just use qa_opts to save the substitutions, that'd be a quick albiet dirty way.

commented Sep 5, 2011 by OllieJames
Thanks NoahY,

Tried that but can not get this to work. Could you give one example of a hard coded substitution?

ANd how would I limit the number of substitutions on each page?

thanks again.