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

244
Vistas
Expand JSON with UTC date/time into weekday sub-entries

I have a JSON structure built with Hugo listing all posts of each User:

{
    "user1": [{
        "publishdate": "2021-10-11T00:00:00Z",
        "section": "news",
        "url": "http://www.example.com/news/another-plain-text/"
    }],
    "user2": [{
        "publishdate": "2021-05-20T00:00:00Z",
        "section": "images",
        "url": "http://www.example.com/images/gifs/"
    }, {
        "publishdate": "2021-05-19T00:00:00Z",
        "section": "images",
        "url": "http://www.example.com/images/external-images/"
    }, {
        "publishdate": "2021-05-18T00:00:00Z",
        "section": "images",
        "url": "http://www.example.com/images/local-images/"
    }]
}

I'll be using this information to build a chart with Chartist:

const settings = {
  // A labels array that can contain any sort of values
  labels: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
  // Our series array that contains series objects or in this case series data arrays
  series: [
    [ 5, 30, 21, 14, 7, 20 ]
  ]
};

However, it proved to be quite a challenge to configure the data like the above example (slightly expanded from Chartist docs) because I don't have entries grouped by weekday and I was trying to avoid having to filter() each entry individually in order to, well, filter, by weekday just so I could count.

How could I, perhaps, expand it into something more usable, in an efficient way? — this example has just a few entries, but that could be hundreds or thousands in a few years.

I know, I should be doing this with Hugo but while it's an incredible tool, slightly more complex theme logics are incredibly difficult to create and Hugo's community is... peculiar.

If you have a more intelligent approach, I'm all ears u.u'

over 4 years ago · Juan Pablo Isaza
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
Asistente virtual