diff options
Diffstat (limited to '_includes')
-rw-r--r-- | _includes/views/pagination-item.html | 32 | ||||
-rw-r--r-- | _includes/views/pagination.html | 48 | ||||
-rw-r--r-- | _includes/views/post-badges.html | 4 | ||||
-rw-r--r-- | _includes/views/post-item.html | 1 | ||||
-rw-r--r-- | _includes/views/segments.html | 8 |
5 files changed, 61 insertions, 32 deletions
diff --git a/_includes/views/pagination-item.html b/_includes/views/pagination-item.html new file mode 100644 index 0000000..bea6d91 --- /dev/null +++ b/_includes/views/pagination-item.html @@ -0,0 +1,32 @@ +{%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%} + +{% assign article = post.content %} +{% assign lang = post.lang %} +{%- include functions.html func='get_reading_time' -%} +{% assign reading_time = return %} +{%- include functions.html func='get_article_excerpt' -%} +{% assign excerpt = return %} +{%- assign post_url = post.url | relative_url -%} + +<li class="{{ post_item_class }}"> + <h2 class="post-title"> + <a class="post-link" href="{{ post_url }}"> + {{ post.title | escape }} + {%- include views/post-badges.html -%} + </a> + </h2> + <div class="post-meta"> + <span class="post-date"><i class="fa fa-calendar"></i> {{ post.date | date: date_format }}</span> + <span class="post-reading-time left-vsplit"><i class="fa fa-clock-o"></i> {{ reading_time }}</span> + </div> + <a class="post-excerpt" href="{{ post_url }}"> + <p> + {{ excerpt }} <span class="read_more">Read More</span> + </p> + </a> + <div class="post-tags"> + {%- for tag in post.tags -%} + <a class="post-tag" href="{{ '/tags.html ' | relative_url }}#{{tag}}">#{{tag}}</a> + {%- endfor -%} + </div> +</li> diff --git a/_includes/views/pagination.html b/_includes/views/pagination.html index 88be011..014df85 100644 --- a/_includes/views/pagination.html +++ b/_includes/views/pagination.html @@ -8,38 +8,24 @@ <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" -%} - - {% assign article = post.content %} - {% assign lang = post.lang %} - {%- include functions.html func='get_reading_time' -%} - {% assign reading_time = return %} - {%- include functions.html func='get_article_excerpt' -%} - {% assign excerpt = return %} - {%- assign post_url = post.url | relative_url -%} + <!-- Top list item --> + {%- if paginator == site or paginator.page == 1 -%} + {%- assign post_item_class = "top-post" -%} + {%- assign posts = site.posts + | where_exp: "item", "item.top > 0" + | sort: "top" -%} + {%- for post in posts -%} + {%- include views/pagination-item.html -%} + {%- endfor -%} + {%- endif -%} - <h2 class="post-title"> - <a class="post-link" href="{{ post_url }}"> - {{ post.title | escape }} - </a> - </h2> - <div class="post-meta"> - <span class="post-date"><i class="fa fa-calendar"></i> {{ post.date | date: date_format }}</span> - <span class="post-reading-time left-vsplit"><i class="fa fa-clock-o"></i> {{ reading_time }}</span> - </div> - <a class="post-excerpt" href="{{ post_url }}"> - <p> - {{ excerpt }} <span class="read_more">Read More</span> - </p> - </a> - <div class="post-tags"> - {%- for tag in post.tags -%} - <a class="post-tag" href="{{ '/tags.html ' | relative_url }}#{{tag}}">#{{tag}}</a> - {%- endfor -%} - </div> - </li> + <!-- Normal list item --> + {%- assign post_item_class = "" -%} + {%- for post in paginator.posts -%} + {%- if post.top -%} + {%- continue -%} + {%- endif -%} + {%- include views/pagination-item.html -%} {%- endfor -%} </ul> diff --git a/_includes/views/post-badges.html b/_includes/views/post-badges.html new file mode 100644 index 0000000..932781a --- /dev/null +++ b/_includes/views/post-badges.html @@ -0,0 +1,4 @@ +<span class="post-badges"> + <span class="post-badge badge-top">TOP</span> + <span class="post-badge badge-new">NEW</span> +</span> diff --git a/_includes/views/post-item.html b/_includes/views/post-item.html index 0d6d129..0cad1f4 100644 --- a/_includes/views/post-item.html +++ b/_includes/views/post-item.html @@ -9,5 +9,6 @@ <span> <a class="post-link" href="{{ post.url | relative_url }}"> {{ post.title | escape }} + {%- include views/post-badges.html -%} </a> </span> diff --git a/_includes/views/segments.html b/_includes/views/segments.html index 2c92dc1..0cf9414 100644 --- a/_includes/views/segments.html +++ b/_includes/views/segments.html @@ -13,7 +13,13 @@ {% assign items = site.posts | where: field, key %} {% for item in items %} {% if item != nil %} - <li> {% include views/post-item.html %} </li> + {%- assign post_item_class = "" -%} + {%- if item.top -%} + {%- assign post_item_class = "top-post" -%} + {%- endif -%} + <li class="{{ post_item_class }}"> + {%- include views/post-item.html -%} + </li> {% endif %} {% endfor %} {% endfor %} |