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

166
Vistas
How to pass markdown parameter to javascript file?

Im using Hugo and Im trying to pass a markdown parameters from md file to JavaScript file.

This is the markdown file

This is my javascript file

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

0

Are you using your own theme, or something you have downloaded?

You can edit the relevant template to output the parameter as a Javascript variable. And after that, use a Javascript function to reference that variable by name. Example:

  <script type="application/javascript">
    var title = "{{.Title}}"
    console.log(title)
  </script>

In this case, you would probably want to add a check to ensure that parameter exists, or is properly set before trying to print it. Otherwise the JS may throw an error if the variable is null or undefined.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Hugo is a static website generator - so it outputs HTML - if you want a "variable" from markdown to Javascript - with traditional JS and Markdown (i.e. no products like Alpine or something beyond the scope of Hugo) you would output the HTML and have Javascript - getElementbyID for instance.

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