Schema.org itemprop="url" inside anchor object (link) I'm trying to use the preprocess function to change the default outpot of links &lt;a href&gt; to include Schema.org's itemprop="url" inside the anchor object, as well as adding a &lt;span itemprop="title"&gt; to the title of the link. For example:

&lt;a href="www.example.com" itemprop="url"&gt;&lt;span itemprop="title"&gt;Example Title&lt;/span&gt;&lt;/a&gt;


*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(&amp;$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!
So after spending some more time on the matter, I finally found the solution and I am posting it here in case anyone is interested.

Simply put the following code in your template.php file, inside your theme folder:

function YOUR-THEME_link($variables) {
  return '&lt;a itemprop="url" href="' . check_plain(url($variables['path'], $variables['options'])) . '"' . drupal_attributes($variables['options']['attributes']) . '&gt;&lt;span itemprop="title"&gt;' . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) . '&lt;/span&gt;&lt;/a&gt;';
}


Hope that helps..
Remember to change 'YOUR-THEME' to your theme's name, and don't forget to clear the cache.