website/_layouts/home.html
2018-10-24 17:51:53 +08:00

60 lines
1.8 KiB
HTML

---
layout: default
---
<div class="home">
{%- if page.title -%}
<h1 class="page-heading">{{ page.title }}</h1>
{%- endif -%}
{{ content }}
{% if site.pinpost %}
<section id="pinned-section">
<h3>Pinned Posts:</h3>
{%- include pinpost.html -%}
</section>
{% endif %}
{%- if site.posts.size > 0 -%}
<h2 class="post-list-heading">{{ page.list_title | default: "Posts" }}</h2>
<!-- Pagination links -->
{% for post in paginator.posts %}
<div class="home-post">
<h2><a href="{{ post.url | relative_url }}" class="post-link">{{ post.title }}</a></h2>
{%- include post_meta.html page=post include_link=true -%}
</div>
{% endfor %}
<script>
function convert_to_wpm(number_of_words = document.querySelectorAll(".no-of-mins")) {
number_of_words.forEach((num) => {
const wpm = 225 /* avg wpm for an adult */
num.textContent = Math.round((Number(num.textContent) / wpm) + 1);
return;
})
}
convert_to_wpm();
</script>
<!-- Pagination links -->
<div class="pagination">
{% if paginator.previous_page %}
<a href="{{ paginator.previous_page_path | relative_url }}" class="previous">Previous</a>
{% else %}
<span class="previous disabled">Previous</span>
{% endif %}
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
{% if paginator.next_page %}
<a href="{{ paginator.next_page_path | relative_url }}" class="next">Next</a>
{% else %}
<span class="next disabled">Next</span>
{% endif %}
</div>
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</a></p>
{%- endif -%}
</div>