jackr
jackr

Reputation: 1437

Jekyll filter to remove pages from site.pages based on page.url?

While generating a Google site map for my (non-github) Jekyll site, I would like to exclude certain files based on the page URL (or file name). In shell-speak, something like

site.pages | grep -v forbidden_name

In Liquid, I imagine a signature something like

site.pages | exclude 'url', forbidden_name

In a related note, is there a catalog of the standard, built-in filters, tags, and generator? Something a bit handier than grep -Rl register_filter ~/.rvm/gems?

Upvotes: 0

Views: 1451

Answers (1)

David Jacquel
David Jacquel

Reputation: 52799

You can try something like

{% for p in site.pages %}
    {% if p.url contains 'ca' %}
        {% comment %}Do nothing{% endcomment %}
    {% else %}
        {{ p.title }}
    {% endif %}
{% endfor %}

A little hacky an case unsensitive and no wild card.

I've made a list of tags and filters that works on Github.

Upvotes: 1

Related Questions