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

127
Vistas
How to list tags for the current post - Eleventy js?

I am using Eleventy JS. And I can't list the tags for the current post. There is nothing written about this in the official documentation.

All tags are listed easily. But for the current post I can not display the tags on the screen

This code to list all tags in Eleventy JS config file

      // Display tag list on page
  eleventyConfig.addCollection('tagsList', function (collectionApi) {
    const tagsList = new Set()
    collectionApi.getAll().map((item) => {
      if (item.data.tags) {
        // handle pages that don't have tags
        item.data.tags.filter((tag) => !['posts'].includes(tag)).map((tag) => tagsList.add(tag))
      }
    })
    return tagsList
  })

This loop of outputting tags in the template

---
permalink:  /blog/category/

pagination:
  data: collections
  size: 77
---

<h1>Tags</h1>

<ul>
    {% for tag in collections.tagsList %}
        <a href="/blog/category/{{tag}}">{{tag}}</a>
    {% endfor %}
</ul>

I use Nunjucks

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

0

Displaying tags for the current post with filter:

{% for tag in tags -%}
    {% if tag !== 'posts' %}
        <a class="tag" href="/blog/category/{{ tag }}">{{ tag }}</a>
    {% endif %}
{%- endfor %}
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