2

Right now the alt value for a menu image is the menu title. Is there a place, an override, where I can change this so that I can add a field to menu: Edit Item, to input an alt value instead?

4
  • Welcome to JSE Robin. As discussed in Glip, the reason you needed these to be different was that your menu item is additionally formatted with other HTML code that then breaks the alt text tag (or displays incorrectly inside the tag). Oct 6 '20 at 0:53
  • Correct! So per our discussion, I removed the HTML from the menu title. This no longer breaks the alt. And I did the rereplace of the menu title to put the html back in. Would be a good idea to have access to these alt tags though :) Oct 6 '20 at 1:00
  • 1
    Thanks for helping me work through this problem. @patrick Oct 6 '20 at 1:01
  • Good to see you in this community @Robin. Please take our tour.
    – mickmackusa
    Oct 6 '20 at 3:54
2

Based on the extra information, that your menu item needs to have part of it displayed using to superscript something, my suggested solution is partially the reverse of what you're asking.

  • Keep the menu item name clean of HTML
  • That keeps the menu image alt tag clean
  • That keeps the page title clean (SEO)
  • Assuming the menu item doesn't change, that makes the ReReplacer Rule cleaner.

I'd use Regular Labs ReReplacer to then find the menu item text that you need to then add the HTML to, and replace that string with the same code, adding in the where required.

So rather than removing the extra formatting in three places, you need to add it just to the one place it appears where it needs to be laid out on screen.

1
  • Additionally, a bug that might need to be addressed in Joomla is where HTML is not stripped out from the alt text field as well as the title field. This would need to be submitted as an issue in the Joomla bug tracker, and eventually a pull request created in GitHub. Oct 6 '20 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.