Schema.org itemprop=”url” inside anchor object (link)

I’m trying to use the preprocess function to change the default outpot of links <a href> to include Schema.org’s itemprop="url" inside the anchor object, as well as adding a <span itemprop="title"> to the title of the link. For example:

<a href="www.example.com" itemprop="url"><span itemprop="title">Example Title</span></a>

*Just to clarify: I want to do this for any link, not just menu or breadcrumb links.

I have managed to do something similar with images using the following code inside my template.php file, but had no luck with adapting it to links:

function THEME_preprocess_image(&$vars)
{
$vars["attributes"]["itemprop"] = "image";
}

Source can be found here.

I know that Microdata module might be able to handle that with a few modifications, however, I’d rather do everything manually instead.

I have spent hours searching for solutions but couldn’t find any..
Any help would be greatly appreciated, thanks!


Go to Source of this post
Author Of this post: Benny
Title Of post: Schema.org itemprop=”url” inside anchor object (link)
Author Link: {authorlink}