Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
Change the type of an a element

I have an <a> element that may or may not have an href attribute.

If this element doesn't have an href element, I get the following error from google.

Links are not crawlable.

Do we have a way to change the type of an <a> element and tell to the bot that this isn't a link anymore ?

<a [href]="url">{{ text }}</a>

Or is as follow the only way

<a *ngIf="url" [href]="url">{{ text }}</a>
<p *ngIf="!url">{{ text }}</p>

The best would be an angular solution, but any javascript is welcome.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As @cloned mentioned, this the a-element need to have an href.

Here's how I have deal with a more complex angular example, since I wanted to change the type of the a-element to avoid copying myself.

<a
  *ngIf="attributes?.url"
  [href]="attributes.url"
>
  <ng-container *ngTemplateOutlet="customContent"></ng-container>
</a>
<div *ngIf="!attributes?.url">
  <ng-container *ngTemplateOutlet="customContent"></ng-container>
</div>

<ng-template #customContent>
  <!-- The lot of content my element needed to be inside -->
</ng-template>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda