Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- layout: null
- ---
- {% capture tags %}
- {% for item in site.[[MY_COLLECTION]] %}
- {% for t in item.tags %}
- {{ t }}
- {% unless forloop.last %}^{% endunless %}
- {% endfor %}
- {% unless forloop.last %}^{% endunless %}
- {% endfor %}
- {% endcapture %}
- {% assign tag_list = tags | strip | strip_newlines| split: "^" | uniq %}
- {% capture links %}
- {% for item in site.[MY_COLLECTION] %}
- {% for tag in taglist %}
- {% for t in item.tags %}
- {% if t == tag %}
- {% capture link_temp %}
- {"source": {{ item.title | strip_newlines | jsonify }}, "target": {{ t | jsonify }}, "value": 1}^
- {% endcapture %}
- {% if link_temp != "" %}
- {{ links | append: link_temp }}
- {% endif %}
- {% assign link_temp = "" %}
- {% endif %}
- {% endfor %}
- {% endfor %}
- {% endfor %}
- {% endcapture %}
- {% assign link_list = links | strip | split: "^" %}
- {% capture my_json %}
- {
- "nodes": [
- {% for item in site.[MY_COLLECTION] %}
- { "id": {{ item.title | strip_newlines | jsonify }}},
- {% endfor %}
- {% for tag in tag_list %}
- { "id": {{ tag | jsonify }}}{% unless forloop.last %},{% endunless %}
- {% endfor %}
- ],
- "links": [
- {% for link in link_list %}
- {{ link | strip | strip_newlines }}{% unless forloop.last %},{% endunless %}
- {% endfor %}
- ]
- }
- {% endcapture %}
- {{ my_json | strip }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement