Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

133
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda