{% assign rawsubjects = "" %} {% for post in site.posts %} {% assign tsubjects = post.subjects | join:'|' | append:'|' %} {% assign rawsubjects = rawsubjects | append:tsubjects %} {% endfor %} {% assign rawsubjects = rawsubjects | split:'|' | sort %} {% assign site.subjects = "" %} {% for subject in rawsubjects %} {% if subject != "" %} {% if subjects == "" %} {% assign subjects = subject | split:'|' %} {% endif %} {% unless subjects contains subject %} {% assign subjects = subjects | join:'|' | append:'|' | append:subject | split:'|' %} {% endunless %} {% endif %} {% endfor %}