_layouts/page.html in jekyll-theme-acg-1.0.9 vs _layouts/page.html in jekyll-theme-acg-1.0.10

- old
+ new

@@ -1,57 +1,125 @@ --- -layout: default +layout: compress --- -{% capture workspace %} - {% assign color = page.color | default: site.color %} - {% assign title = page.title %} - {% assign description = page.description %} - {% assign content = content | strip %} +{% capture lang %}{{ page.lang | default: site.lang | default: "en-US" }}{% endcapture %} - {% assign list = "" | split: "" %} +{% 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 %} - {% if page.permalink == "/404.html" %} - {% capture title %}<span class="text-6xl">404</span>{% endcapture %} - {% capture description %}{{ site.acg.error | default: "Page not found." }}{% endcapture %} - {% elsif page.permalink == "/categories.html" %} - {% assign title = site.acg.categories %} - {% for item in site.categories %}{% assign list = list | push: item[0] %}{% endfor %} - {% elsif page.permalink == "/tags.html" %} - {% assign title = site.acg.tags %} - {% for item in site.tags %}{% assign list = list | push: item[0] %}{% endfor %} - {% endif %} +{% comment %} background {% endcomment %} +{% capture background %}{{ page.background | default: site.acg.background | default: "https://cdn.jsdelivr.net/gh/coderzhaoziwei/jekyll-theme-acg/assets/images/pixiv86925095.png" | relative_url }}{% endcapture %} - {% assign list = list | sort %} +{% assign title = page.title %} +{% assign description = page.description %} +{% assign content = content | strip %} -{% endcapture %} +{% 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 }}{% endcapture %} + {% capture description %}{{ site.acg.categories.description }}{% endcapture %} +{% elsif page.permalink == "/tags.html" %} + {% capture title %}{{ site.acg.tags.label }}{% endcapture %} + {% capture description %}{{ site.acg.tags.description }}{% endcapture %} +{% elsif page.permalink == "/about.html" %} + {% capture title %}{{ site.acg.about.label }}{% endcapture %} + {% capture description %}{{ site.acg.about.description }}{% endcapture %} +{% elsif page.permalink == "/friends.html" %} + {% capture title %}{{ site.acg.friends.label }}{% endcapture %} + {% capture description %}{{ site.acg.friends.description }}{% endcapture %} +{% elsif page.permalink == "/404.html" %} + {% capture title %}{{ site.acg.error.label }}{% endcapture %} + {% capture description %}{{ site.acg.error.description }}{% 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 py-32 text-{{ color }}-50 flex flex-col justify-center items-center content-center"> + <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 item-category.html name=title title=true %} - {% elsif page.type == "tag" %}{% include item-tag.html name=title title=true %} - {% else %}{{ title }}{% endif %} + {% 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/tags: list --> + + <!-- categories.html & tags.html --> <div class="flex flex-wrap justify-center items-center content-center select-none"> {% if page.permalink == "/categories.html" %} - {% for name in list %}{% assign count = site.categories[name].size %} - <div class="m-1 px-2 bg-{{ color }}-50 bg-opacity-75 rounded">{% include item-category.html name=name count=count %}</div> + {% 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 name in list %}{% assign count = site.tags[name].size %} - <div class="m-1 px-2 bg-{{ color }}-50 bg-opacity-75 rounded">{% include item-tag.html name=name count=count %}</div> + {% 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> - - <!-- content --> - {% if 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.posts %}<div class="w-full p-4 flex flex-col space-y-4">{% include posts.html posts=page.posts %}</div>{% endif %} - </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>