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

234
Vistas
How to insert current date shortcode for hugo website

So far I have successfully put an iframe shortcode on my site.

What I want to do is put today's date into the iframe url where I have the date, like this where I have an old static date:

{{< charts "https://unnamed.website/dontguess/performance_chart_viewer.aspx?environment=DEV&date=2022-03-31&type=Daily_CPU" >}}

Here is my "charts" shortcode definition for the iframe:

<iframe src="{{.Get 0}}"&type=Daily_CPU width="1080" height="800" frameborder="0"></iframe>

Here is my "date" shortcode with some javascript to get today's date:

<script>
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = yyyy + '-' + mm + '-' + dd;
document.write(today);
</script>

I have been trying a hand full of things and nothing seems to work right, so far.

I thought this would have worked in the iframe shortcode definition, but it does not:

<iframe src="{{.Get 0}}{{< date >}}"&type=Daily_CPU width="1080" height="800" frameborder="0"></iframe>

Clearly I'm doing something wrong here. Can you help me? Is there an easier way that I'm not thinking of?

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

0

Untested but should lead you in the right direction...

{{< charts "https://unnamed.website/dontguess/performance_chart_viewer.aspx?environment=DEV&date=2022-03-31&type=Daily_CPU" >}}

Becomes:

{{< charts "https://unnamed.website/dontguess/performance_chart_viewer.aspx?environment=DEV&date={{now.Format | "YOUR NEEDED FORMAT HERE"}}&type=Daily_CPU" >}}

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