See an option with CSS, but I make it clear that it is not very semantic, because even with font 0 a screen reader can have access to that text ...
The technique is to "erase" the text within the link by setting the size of font
to 0 , however you use a pseudo-element ::after
in link and using the content:""
property; You put the new text.
Note that only the element that the href = /rota/rota1
attribute will receive the new text
[href="/rota/rota1"] {
font-size: 0;
color:red; /* cor de texto que o filho ::after vai herdar */
}
[href="/rota/rota1"]::after {
content: " MEU TEXTO NOVO";
font-size: 16px !important;
}
<td class="corpo-nome">
<a href="/rota/rota1">
guilherme
</a>
</td>
<td class="corpo-nome">
<a href="/rota/rota2">
João
</a>
</td>
If you want only the link within <td>
with class .corpo-nome
to have the text changed just put the css in this way
.corpo-nome a{
font-size: 0;
color:red;
}
.corpo-nome a::after {
content: " MEU TEXTO NOVO";
font-size: 16px !important;
}
<table>
<tr>
<td class="corpo-nome">
<a href="/rota/rota1">
guilherme
</a>
</td>
</tr>
</table>
Keep in mind that: The user may not even see the text that we hide with font-size: 0, but Google Bot is sure to read that content. you see with your eyes, but for crawlers and screen readers the text will remain accessible ...