newtheatre/history-project

View on GitHub
feeds/search.json

Summary

Maintainability
Test Coverage
---
# Search index feed, is processed by _coffee/search_index_generator.coffee to
# build the actual index used on the live site.
excerpt: ""
---
{% assign first = true %}
[
{% for show in site.shows %}
    {% if show.title != null and show.title != empty %}
    {% unless first %},{% endunless %}{
        "title": {{show.title | jsonify}},
        "type": "show",
        {% assign posters = show.assets | where:'type', 'poster' %}
        {% if show.poster %}"poster_thumb_tag": "<a href='{{show.url}}'><img src='{{ show.poster.image.poster_search }}' class='search-result-poster-thumb' alt='{{ show.title }} poster' /></a>",{% endif %}
        {% assign year_page = site.pages | where: "group", "year" | where: "year", show.year %}
        "year_title": {{ show.year_page.title | jsonify }},
        "content": {{ show.content | markdownify | strip_html | jsonify }},
        "playwright": {{ show.playwright | jsonify }},
        "playwright_formatted": {{ show.playwright_formatted | jsonify }},
        "playwright_formatted_long": {{ show.playwright_formatted_long | jsonify }},
        "season": {{ show.season | jsonify }},
        "venue": {{ show.venue | jsonify }},
        "link": "{{ show.url }}",
        "date": "{{ show.date_start }}",
        "run": "{% if show.date_start %}{% include liquid/date_range.html %}{% else %}{{ show.year_page.title }} (Dates Unknown){% endif %}",
        "excerpt": {{ show.content | strip_html | truncatewords: 50 | jsonify }},
        "cast": "{% for person in show.cast %}{{person.name}}, {% endfor %}",
        "crew": "{% for person in show.crew %}{{person.name}}, {% endfor %}"
    }
    {% assign first = false %}
    {% endif %}
{% endfor %}

{% for person in site.people %}
    {% unless first %},{% endunless %}{
        "title": {{ person.title | jsonify }},
        "type": "person",
        "excerpt": {{ person.content | strip_html | truncatewords: 50 | jsonify}},
        {% if person.headshot %}"poster_thumb_tag": "<a href='{{person.url}}'><img src='{{person.headshot.person_search}}' class='search-result-poster-thumb' alt='{{person.name}}' /></a>",{% endif %}
        "graduated": {% if person.student == true %}"Student"{% else if person.graduated %}{{ person.graduated | jsonify }}{% else %}"Unknown"{% endif %},
        "award": {{ person.award | jsonify }},
        "link": {{ person.url | jsonify }}
    }
    {% assign first = false %}
{% endfor %}

{% for page in site.content %}
    {% if page.title != null and page.title != empty and page.group != "year" and page.search != false %}
    {% unless first %},{% endunless %}{
        "title": {{ page.title | jsonify }},
        "type": "page",
        "group": "{{ page.group }}",
        "content": {{ page.content | strip_html | jsonify }},
        "link": "{{ page.url | replace: 'index.html', '' }}",
        "date": {{ page.date | jsonify }},
        "excerpt": {% if page.excerpt %}{{ page.excerpt | jsonify }}{% else %}{{ page.content | strip_html | truncatewords: 50 | jsonify}}{% endif %}
    }
    {% assign first = false %}
    {% endif %}
{% endfor %}
]