layout: compress


{% capture lang %}{{ page.lang | default: site.lang | default: “en-US” }}{% endcapture %}

{% comment %} color {% endcomment %} {% capture color %}{{ page.color | default: site.color | downcase }}{% endcapture %} {% assign colors = “red, blue, pink, green, yellow, purple, gray, default” | split: “, ” %} {% for item in colors %}

{% if item == color %}{% break %}{% endif %}
{% if item == "default" %}{% assign color = "red" %}{% endif %}

{% endfor %}

{% comment %} background {% endcomment %} {% capture background %}{{ page.background | default: site.acg.background | default: “” | relative_url }}{% endcapture %}

{% assign title = page.title %} {% assign description = page.description %} {% assign content = content | strip %}

{% if page.type == “home” %}

{% capture title %}{{ site.title }}{% endcapture %}
{% capture description %}{{ site.description }}{% endcapture %}

{% elsif page.permalink == “/categories.html” %}

{% capture title %}{{ site.acg.categories.label | default: "Categories" }}{% endcapture %}
{% capture description %}{{ site.acg.categories.description }}{% endcapture %}

{% elsif page.permalink == “/tags.html” %}

{% capture title %}{{ site.acg.tags.label | default: "Tags" }}{% endcapture %}
{% capture description %}{{ site.acg.tags.description }}{% endcapture %}

{% elsif page.permalink == “/about.html” %}

{% capture title %}{{ site.acg.about.label | default: "About" }}{% endcapture %}
{% capture description %}{{ site.acg.about.description }}{% endcapture %}

{% elsif page.permalink == “/friends.html” %}

{% capture title %}{{ site.acg.friends.label | default: "Friends" }}{% endcapture %}
{% capture description %}{{ site.acg.friends.description }}{% endcapture %}

{% elsif page.permalink == “/404.html” %}

{% capture title %}{{ site.acg.error.label | default: '<span class="text-6xl">404</span>' }}{% endcapture %}
{% capture description %}{{ site.acg.error.description | default: "Page not found." }}{% endcapture %}

{% endif %}

{% assign list = “” | split: “” %} {% if page.permalink == “/categories.html” %}

{% for item in site.categories %}{% assign list = list | push: item[0] %}{% endfor %}

{% elsif page.permalink == “/tags.html” %}

{% for item in site.tags %}{% assign list = list | push: item[0] %}{% endfor %}

{% endif %} {% assign list = list | sort %}

<!DOCTYPE html> <html lang=“{{ lang }}” class=“min-h-screen bg-image bg-cover bg-center bg-fixed”> {% include head.html %} <body class=“flex flex-col items-center bg-black bg-opacity-50”> {% include header.html %} <div class=“w-acg min-h-screen py-16”>

<div class="w-full flex flex-col justify-center items-center content-center text-{{ color }}-50
  {% if page.type == "home" %}h-screen select-none pb-16{% else %}py-32{% endif %}"
>
  <!-- title -->
  <div class="text-center text-4xl font-serif py-8">
    {% if page.type == "category" %}
      {% include chip.html type="category" text=title width=8 larger=true %}
    {% elsif page.type == "tag" %}
      {% include chip.html type="tag" text=title width=8 larger=true %}
    {% else %}
      {{ title }}
    {% endif %}
  </div>
  <!-- description -->
  <div class="text-center text-base font-sans py-8">{{ description }}</div>

  <!-- categories.html & tags.html -->
  <div class="flex flex-wrap justify-center items-center content-center select-none">
  {% if page.permalink == "/categories.html" %}
    {% for category in list %}{% assign count = site.categories[category].size %}
      <div class="m-1 px-2 bg-{{ color }}-50 bg-opacity-75 rounded">
        {% include chip.html type="category" text=category count=count width=4 %}
      </div>
    {% endfor %}
  {% elsif page.permalink == "/tags.html" %}
    {% for tag in list %}{% assign count = site.tags[tag].size %}
      <div class="m-1 px-2 bg-{{ color }}-50 bg-opacity-75 rounded">
        {% include chip.html type="tag" text=tag count=count width=4 %}
      </div>
    {% endfor %}
  {% endif %}
  </div>
</div>

<!-- article -->
{% if page.type == "post" %}
  <div class="flex flex-wrap">
    <div class="flex-grow">
      {% include chip.html type="date" text=page.date width=4 %}
    </div>
    <div class="flex flex-wrap">
      {% for category in page.categories %}
        {% include chip.html type="category" text=category width=4 %}
      {% endfor %}
      {% for tag in page.tags %}
        {% include chip.html type="tag" text=tag width=4 %}
      {% endfor %}
    </div>
  </div>
  <article class="w-full my-4 mx-auto p-4 rounded-lg text-black bg-{{ color }}-50 bg-opacity-75 markdown-body">
    <h1>{{ title }}</h1>
    {% include toc.html html=content %}
    {{ content }}
  </article>
  {% include flip.html %}
{% elsif content != empty %}
  <article class="w-full my-4 mx-auto p-4 rounded-lg text-black bg-{{ color }}-50 bg-opacity-75 markdown-body">
    {{ content }}
  </article>
{% endif %}
<!-- posts -->
{% if page.type == "home" %}
  <div class="w-full p-4 flex flex-col space-y-4">{% include posts.html posts=site.posts %}</div>
  <div class="w-full p-4">{% include paginator.html %}</div>
{% elsif page.posts %}
  <div class="w-full p-4 flex flex-col space-y-4">{% include posts.html posts=page.posts %}</div>
{% endif %}

</div> {% include footer.html %} </body> </html>