I would like to write a script which determines the position of hyperlinks from other domains which link to my website. For example I want to know if the link comes from “inside an article”, “inside a sidebar (left / right)”, “inside the footer”. The only way I can think of is to check the CSS classes which wrap the link. For example a link is inside the class “left_sidebar”, then it’s likely inside the left sidebar 🙂
But this seems like a buggy way to determine this. This may work with well designed WordPress themes, but will fail with many other sites.
So is there a better way to do this? Thanks!
There are more creative ways to achieve what I think you’re driving at. Instead of thinking in terms of section think of context. If a link resides in a p tag with a fair amount of additional text we can infer it’s part of an article and not a set of links.
Combine a set of these inferences, add weight and you start building something that you can fine-tune.