summaryrefslogtreecommitdiff
path: root/_includes/views
diff options
context:
space:
mode:
authorJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-11 12:19:34 +0800
committerJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-11 12:21:17 +0800
commit61eae5c5f9881cab29712f6e696085baa977e1f9 (patch)
treebb301b58b94fee5dcefbdfae8f0c8fc13ee5bd21 /_includes/views
parentcd3a8163dd997d0a7c4d320816651efa8f7dce60 (diff)
release: v1.0.0
Diffstat (limited to '_includes/views')
-rw-r--r--_includes/views/article.html11
-rw-r--r--_includes/views/banner.html66
-rw-r--r--_includes/views/footer.html13
-rw-r--r--_includes/views/header.html44
-rw-r--r--_includes/views/pagination.html33
-rw-r--r--_includes/views/paginator.html21
-rw-r--r--_includes/views/post-header.html11
-rw-r--r--_includes/views/post-item.html13
-rw-r--r--_includes/views/segments.html21
-rw-r--r--_includes/views/site-brand.html1
10 files changed, 234 insertions, 0 deletions
diff --git a/_includes/views/article.html b/_includes/views/article.html
new file mode 100644
index 0000000..e7bd144
--- /dev/null
+++ b/_includes/views/article.html
@@ -0,0 +1,11 @@
+<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
+
+ <div class="post-content e-content" itemprop="articleBody">
+
+ {{ content }}
+
+ </div>
+
+ <div>
+
+</article>
diff --git a/_includes/views/banner.html b/_includes/views/banner.html
new file mode 100644
index 0000000..7878997
--- /dev/null
+++ b/_includes/views/banner.html
@@ -0,0 +1,66 @@
+{%- include functions.html func='log' level='debug' msg='Get banner_html value' -%}
+{% assign name = 'banner_html' %}
+{%- include functions.html func='get_value' -%}
+{% assign banner_html = return %}
+
+{%- include functions.html func='log' level='debug' msg='Get banner value' -%}
+{% assign name = 'banner' %}
+{%- include functions.html func='get_value' -%}
+{% assign banner = return %}
+
+{%- include functions.html func='log' level='debug' msg='Get heading value' -%}
+{% assign name = 'heading' %}
+{%- include functions.html func='get_value' -%}
+{% assign heading = return %}
+
+{%- include functions.html func='log' level='debug' msg='Get subheading value' -%}
+{% assign name = 'subheading' %}
+{%- include functions.html func='get_value' -%}
+{% assign subheading = return %}
+
+{% if banner %}
+
+ {% assign auto_banner = true %}
+ {% assign array = banner | split: '//' %}
+ {% assign protocol = array[0] %}
+
+ {% if array.size > 1 and (protocol == '' or protocol == 'http:' or protocol == 'https:') %}
+ {% assign auto_banner = false %}
+ {% endif %}
+
+ <section class="page-banner">
+ <div class="page-banner-img">
+ {%- if auto_banner == false -%}
+ <div style="background-image: url({{ banner }})"></div>
+ {%- endif -%}
+ </div>
+ <div class="wrapper">
+ <div class="page-banner-inner">
+
+ {%- if banner_html -%}
+
+ {%- assign banner_html = 'views/' | append: banner_html -%}
+ {%- include {{ banner_html }} -%}
+
+ {%- else -%}
+
+ <h1 class="page-banner-heading">
+ {{ heading | default: page.title | escape }}
+ </h1>
+ <h3 class="page-banner-subheading">
+ {{ subheading | default: page.subtitle | escape }}
+ </h3>
+
+ {%- endif -%}
+ </div>
+ </div>
+ </section>
+
+ {%- if auto_banner -%}
+ {%- assign selector = ".page-banner-img" -%}
+ {%- assign seed = page.id | append: '-seed-' | append: banner -%}
+ {%- include extensions/trianglify.html -%}
+ {%- endif -%}
+
+{%- endif -%}
+
diff --git a/_includes/views/footer.html b/_includes/views/footer.html
new file mode 100644
index 0000000..2df399b
--- /dev/null
+++ b/_includes/views/footer.html
@@ -0,0 +1,13 @@
+<footer class="site-footer h-card">
+ <data class="u-url" href="{{ "/" | relative_url }}"></data>
+
+ <div class="wrapper">
+ <span>
+ <div>{{ site.copyright }} @{{ site.author | escape }}</div>
+ <div>Powered by <a title="Jekyll is a simple, blog-aware, static site
+ generator." href="http://jekyllrb.com/">Jekyll</a> &amp; <a title="Yat, yet
+ another theme." href="https://github.com/jeffreytse/jekyll-theme-yat">Yat Theme</a>.</div>
+ </span>
+ <span class="footer-col rss-subscribe">Subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</a></span>
+ </div>
+</footer>
diff --git a/_includes/views/header.html b/_includes/views/header.html
new file mode 100644
index 0000000..06a20ed
--- /dev/null
+++ b/_includes/views/header.html
@@ -0,0 +1,44 @@
+<header class="site-header" role="banner">
+
+ <div class="wrapper">
+ {%- assign default_paths = site.pages | where: "dir", "/" | map: "path" -%}
+ {%- assign page_paths = site.header_pages | default: default_paths -%}
+
+ <span class="site-brand">
+ {%- include views/site-brand.html -%}
+ </span>
+
+ {%- if page_paths -%}
+ <nav class="site-nav">
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
+ <label for="nav-trigger">
+ <span class="menu-icon">
+ <svg viewBox="0 0 18 15" width="18px" height="15px">
+ <path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/>
+ </svg>
+ </span>
+ </label>
+
+ <div class="trigger">
+ {%- for path in page_paths -%}
+ {%- assign my_page = site.pages | where: "path", path | first -%}
+ {%- if my_page.title -%}
+ <a class="page-link" href="{{ my_page.url | relative_url }}">
+ {{ my_page.title | upcase | escape }}
+ </a>
+ {%- endif -%}
+ {%- endfor -%}
+
+ {%- assign name = 'translate_langs' -%}
+ {%- include functions.html func='get_value' -%}
+ {%- assign translate_langs = return -%}
+ {%- if translate_langs.size > 0 -%}
+ <span class="page-link">
+ {%- include extensions/google-translate.html -%}
+ </span>
+ {%- endif -%}
+ </div>
+ </nav>
+ {%- endif -%}
+ </div>
+</header>
diff --git a/_includes/views/pagination.html b/_includes/views/pagination.html
new file mode 100644
index 0000000..11eb5aa
--- /dev/null
+++ b/_includes/views/pagination.html
@@ -0,0 +1,33 @@
+{%- if page.paginator -%}
+ {%- assign paginator = page.paginator -%}
+{%- elsif paginator == nil -%}
+ {%- assign paginator = site -%}
+{%- endif -%}
+
+{%- if paginator.posts.size > 0 -%}
+<div class="pagination">
+ <!-- Post list links -->
+ <ul class="post-list">
+ {%- for post in paginator.posts -%}
+ <li>
+ {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%}
+ <span class="post-meta">{{ post.date | date: date_format }}</span>
+ <h3>
+ {%- assign post_url = post.url | relative_url -%}
+ <a class="post-link" href="{{ post_url }}">
+ {{ post.title | escape }}
+ </a>
+ </h3>
+ <p class="post-excerpt">
+ {{ post.content | strip_html | truncatewords: 50 }}
+ </p>
+ </li>
+ {%- endfor -%}
+ </ul>
+
+ <!-- Pagination links -->
+ {%- if paginator.posts.size < site.posts.size -%}
+ {%- include views/paginator.html -%}
+ {%- endif -%}
+</div>
+{%- endif -%}
diff --git a/_includes/views/paginator.html b/_includes/views/paginator.html
new file mode 100644
index 0000000..269c20b
--- /dev/null
+++ b/_includes/views/paginator.html
@@ -0,0 +1,21 @@
+{% if include.paginator %}
+ {% assign paginator = include.paginator %}
+{% endif %}
+
+{% if paginator.posts.size > 0 %}
+ <div class="pagination">
+ {% if paginator.previous_page %}
+ <a href="{{ paginator.previous_page_path }}">&laquo; Prev</a>
+ {% else %}
+ <span>&laquo; Prev</span>
+ {% endif %}
+
+ <span> {{ paginator.page }}/{{ paginator.total_pages }}</span>
+
+ {% if paginator.next_page %}
+ <a href="{{ paginator.next_page_path }}">Next &raquo;</a>
+ {% else %}
+ <span>Next &raquo;</span>
+ {% endif %}
+ </div>
+{% endif %}
diff --git a/_includes/views/post-header.html b/_includes/views/post-header.html
new file mode 100644
index 0000000..82329bd
--- /dev/null
+++ b/_includes/views/post-header.html
@@ -0,0 +1,11 @@
+<header class="post-header">
+ <h1 class="post-title p-name" itemprop="name headline">{{ heading | default: page.title | escape }}</h1>
+ <h3>{{ subheading | default: page.subtitle | escape }}</h3>
+
+ <p class="post-meta">
+ <time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
+ {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%}
+ {{ page.date | date: date_format }}
+ </time>
+ </p>
+</header>
diff --git a/_includes/views/post-item.html b/_includes/views/post-item.html
new file mode 100644
index 0000000..0d6d129
--- /dev/null
+++ b/_includes/views/post-item.html
@@ -0,0 +1,13 @@
+{%- if include.item -%}
+ {%- assign item = include.item -%}
+{%- endif -%}
+
+{%- assign post = item -%}
+
+{% assign date_format = site.yat.date_format | default: "%b %-d, %Y" %}
+<span class="post-meta">{{ post.date | date: date_format }}</span>
+<span>
+ <a class="post-link" href="{{ post.url | relative_url }}">
+ {{ post.title | escape }}
+ </a>
+</span>
diff --git a/_includes/views/segments.html b/_includes/views/segments.html
new file mode 100644
index 0000000..2c92dc1
--- /dev/null
+++ b/_includes/views/segments.html
@@ -0,0 +1,21 @@
+{%- if include.keys -%}
+ {%- assign keys = include.keys -%}
+{%- endif -%}
+
+{%- if include.field -%}
+ {%- assign field = include.field -%}
+{%- endif -%}
+
+<div class="page-segments">
+ <ul class="page-segments-list">
+ {% for key in keys %}
+ <h2 id="{{ key }}" class="segment-name">{{ key }}</h2>
+ {% assign items = site.posts | where: field, key %}
+ {% for item in items %}
+ {% if item != nil %}
+ <li> {% include views/post-item.html %} </li>
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+ </ul>
+</div>
diff --git a/_includes/views/site-brand.html b/_includes/views/site-brand.html
new file mode 100644
index 0000000..5652aff
--- /dev/null
+++ b/_includes/views/site-brand.html
@@ -0,0 +1 @@
+<a class="site-title" rel="author" href="{{ "/" | relative_url }}">{{ site.title | escape }}</a>