Additional attribute for menu link How I can add itemprop=&quot;url&quot; for each link (&lt;a&gt;) in main menu?
So, I need to get from
&lt;a href=&quot;/node/114&quot; data-drupal-link-system-path=&quot;node/114&quot;&gt;Test&lt;/a&gt;

to
&lt;a href=&quot;/node/114&quot; data-drupal-link-system-path=&quot;node/114&quot; itemprop=&quot;url&quot;&gt;Test&lt;/a&gt;

Is it possible to do it in preprocess? I would like not to use any module for this.
Try
function HOOK_link_alter(&amp;$variables) or function HOOK_preprocess_menu(&amp;$variables)
Or just override the menu template (menu--main.html.twig) and replace line
{{ link(item.title, item.url, {'class': link_classes}) }}
with
{{ link(item.title, item.url, item.attributes.addClass(link_classes).setAttribute('itemprop', 'url') }}