Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!