Sha256: 02934819b2399dd69971386f7d93583dcf7d569a9ff3629911e1110c9e24a02d

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

{% comment %}
  
  Usage: 
    {% assign tag_attr = page.attributes | link_type: "tags" %}
    {% include tags.html tag_attr=tag_attr tag_fm=page.tags %}

  Parameters:
    * tag_attr          (array) - array of attributes that are hashes with keys 
                                  'type' and 'urls'
                                  (which correspond to `jekyll-wikilinks` 
                                   attributes and attributed metadata)
    * tag_fm            (array) - array of strings that are tag names 
                                  (which correspond to entry filenames)

  Note:
    To be used with germ-type documents.
    (e.g. markdown documents that use tags metadata to map to entries)

{% endcomment %}


<!-- 'tags' attribute -->
{% assign tag_attrs = page.attributes | link_type: "tags" %}
{% for tag_attrs in tag_attrs %}
  {% for url in tag_attrs.urls %}
    {% assign entry = site.entries | where: "url", url | first %}
    <button class="tag-pill {% if entry %}{% else %}disabled{% endif %}">
      {% if entry %}
        {% include btn_state.html states=entry.status %}
        <a class="sem-tag" href="{{ entry.url | relative_url }}">{{ entry.title }}</a>
      {% else %}
        <span class="text--small">{{ site.data.emoji.missing }} {{ sem_tag }}</span>
      {% endif %}
    </button>
  {% endfor %}
{% endfor %}
<!-- 'tags' frontmatter -->
{% for sem_tag in page.tags %}
  <!-- prefix with '/' to prevent matching subhierarchies -->
  {% assign sem_tag_path = "/" | append: sem_tag | append: ".md" %}
  {% assign entry = site.entries | find_exp: "item", "item.path contains sem_tag_path" %}
  <button class="tag-pill {% if entry %}{% else %}disabled{% endif %}">
    {% if entry %}
      {% include btn_state.html states=entry.status %}
      <a class="sem-tag" href="{{ entry.url | relative_url }}">{{ entry.title }}</a>
    {% else %}
      <span class="text--small">{{ site.data.emoji.missing }} {{ sem_tag }}</span>
    {% endif %}
  </button>
{% endfor %}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-bonsai-0.0.5 _includes/tags.html