Forum Moderators: open

Message Too Old, No Replies

href has an alt attribute instead of anchor?

         

TomSnow

6:10 pm on Dec 12, 2019 (gmt 0)

5+ Year Member Top Contributors Of The Month



Hi guys,

Ran into something I haven't seen.

My dev created a top nav menu that has images (icons).

Looks like my anchored links are mixed up in the image code:

<img class="link-icon" src="/wp-content/themes/********/images/********.svg" alt="Photo description">
<a href="/********/**********/" alt="photo description">Accidente de auto</a>

My anchor text has an alt tag right before it. Anyone know if this will still be crawled just fine by Google. Will Google still recognize my anchor text or will they think it's an alt text?

Thanks!

NickMNS

6:28 pm on Dec 12, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This links answers your question:
[stackoverflow.com...]
tl-dr: No it is not valid html and should be corrected by your dev.

lucy24

10:11 pm on Dec 12, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



My dev created a top nav menu that has images (icons).

Looks like my anchored links are mixed up in the image code:
How much are you paying your dev? (That was a rhetorical question, since the answer can only be “too much”.)

phranque

10:18 pm on Dec 12, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



the alt attribute of the anchor tag is not valid and will therefore be ignored.

TomSnow

6:06 pm on Dec 17, 2019 (gmt 0)

5+ Year Member Top Contributors Of The Month



Thanks guys. Fixed.

Just FYI when I spidered my staging site, I saw Screaming Frog could find the anchor text for these links that have alt inside the a element.

Do you guys still think the alt text inside the a element would prevent Google from properly reading my links/anchors?

Just wondering what the issue would be.

Thanks again!

lucy24

6:34 pm on Dec 17, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think you’re asking the wrong question. You’ve spotted something that is already, intrinsically a problem: site code that creates bad HTML. That’s all you need to know. Fix it.

Seriously, it’s like discovering when you’re halfway to work that you’ve forgotten to put your pants on. You don’t spend time thinking about what effect this might conceivably have on your coworkers, who never set foot in your cubicle anyway, or the owner, who only visits the site twice a month. You turn around and go home and get dressed regardless.

Given time, I could probably have come up with a more elgant analogy.

NickMNS

6:54 pm on Dec 17, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Seriously, it’s like discovering when you’re halfway to work that you’ve forgotten to put your pants on.

I do that all the time! I generally don't realize it until long after I've started working. But then again, halfway to work for me is only about five steps down the stairs.