Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
How to make an href dynamic using Custom Elements

I wanted to make a header with navs (local website) , and the same header will be repeated in all pages. So instead of copy pasting it, i made a custom element in js. The problem is that the hrefs in the main page will be different than the other pages.

This is how it should be in the main page

<a href="pages/somepage.html">

And this is how it should be in other pages who are in the same folder

<a href="somepage.html">

Using a custom element will make them all have the same href.

Is there a solution to this or am i missing something really obvious ? I could just have them all in the same folder but that will get messy the more pages i add.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Make your href absolute by putting a / at the front.

eg

<a href="/pages/somepage.html">
about 4 years ago · Juan Pablo Isaza Denunciar

0

Maybe you make links following:

<a href="/pages/somepage.html">

if you add / to front link browser search the folder.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda