{% assign articles = site.articles | order: “last_published_at DESC” | search: request.params[“q”] | to_array %}
{% assign active_class = ‘active’ %}
{% if request.params[“days”] == “all” %}
{% assign articles = articles %}
{% assign active_class_all = ‘active’ %}
{% elsif request.params[“days”] == “d” %}
{% assign articles = articles | where: “last_published_at > now() – interval ‘1 day'” %}
{% assign active_class_day = ‘active’ %}
{% elsif request.params[“days”] == “w” %}
{% assign articles = articles | where: “last_published_at > now() – interval ‘1 week'” %}
{% assign active_class_week = ‘active’ %}
{% elsif request.params[“days”] == “m” %}
{% assign articles = articles | where: “last_published_at > now() – interval ‘1 month'” %}
{% assign active_class_month = ‘active’ %}
{% elsif request.params[“days”] == “y” %}
{% assign articles = articles | where: “last_published_at > now() – interval ‘1 year'” %}
{% assign active_class_year = ‘active’ %}
{% endif %}
{{ request.params[“q”] | escape }} の検索結果
{% if articles.size > 0 %}
{% paginate articles per 10 %}
{% render ‘article’ | article: article %}
{% endfor %}
{% endif %}