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?
-
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).– Patrick JacksonCommented Oct 6, 2020 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 :)– Robin ClappCommented Oct 6, 2020 at 1:00
-
1Thanks for helping me work through this problem. @patrick– Robin ClappCommented Oct 6, 2020 at 1:01
-
Good to see you in this community @Robin. Please take our tour.– mickmackusaCommented Oct 6, 2020 at 3:54
1 Answer
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.
-
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. Commented Oct 6, 2020 at 1:01