Add ETA time
This commit is contained in:
@@ -4,6 +4,19 @@ var hamburgerShown = false;
|
||||
let width = screen.width;
|
||||
var isMobile = width < 1024;
|
||||
|
||||
function readingTime() {
|
||||
let articles = document.querySelectorAll(".article");
|
||||
let times = document.querySelectorAll(".time");
|
||||
const wpm = 225;
|
||||
let words;
|
||||
for (var i = 0; i < articles.length; i++) {
|
||||
words = articles[i].innerText.trim().split(/\s+/).length;
|
||||
let time = Math.ceil(words / wpm);
|
||||
times[i].innerText = `${time} minute read`
|
||||
}
|
||||
}
|
||||
readingTime()
|
||||
|
||||
function toggleMenu(button) {
|
||||
if (displayedMenu === button.id.split("-")[0]) {
|
||||
button.className = button.className.replace(" text-gray-800 bg-stone-200 sm:bg-transparent", " text-gray-900");
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
|
||||
if (!internal_hosts.includes(links[i].hostname)) {
|
||||
links[i].target = '_blank';
|
||||
console.log(links[i])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,48 +2,32 @@
|
||||
{% block content %}
|
||||
|
||||
{% if page.taxonomies.people %}
|
||||
{% set people = get_section(path="people/_index.md") %}
|
||||
{% set pages_str = people.pages | json_encode() | as_str %}
|
||||
{% if pages_str is containing(page.taxonomies.people[0]) %}
|
||||
{% set author_path = 'people/' ~ page.taxonomies.people[0] ~ '/index.md' %}
|
||||
{% set author = get_page(path=author_path) %}
|
||||
{% endif %}
|
||||
{% set people = get_section(path="people/_index.md") %}
|
||||
{% set pages_str = people.pages | json_encode() | as_str %}
|
||||
{% if pages_str is containing(page.taxonomies.people[0]) %}
|
||||
{% set author_path = 'people/' ~ page.taxonomies.people[0] ~ '/index.md' %}
|
||||
{% set author = get_page(path=author_path) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Default page template for blog posts and basic informative markdown files -->
|
||||
|
||||
{% set split = page.content | split(pat="threefold.io") %}
|
||||
{% if split | length < 2 %}
|
||||
{% set content = page.content %}
|
||||
{% else %}
|
||||
{% set content = "" %}
|
||||
{% for part in split %}
|
||||
{% if part is starting_with("/blog") %}
|
||||
{% set split_part = part | split(pat='/">') %}
|
||||
{% set link = split_part[0] %}
|
||||
{% set link = link | replace(from="/blog/post", to="/blog") %}
|
||||
{% set link = link | replace(from="_", to="-") %}
|
||||
{% set rest_part = split_part | slice(start=1) | join(sep='/">') %}
|
||||
{% set part = link ~ '/">' ~ rest_part %}
|
||||
{% endif %}
|
||||
{% if loop.first %}
|
||||
{% set_global content = part%}
|
||||
{% else %}
|
||||
{% set_global content = content ~ "threefold.io" ~ part%}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<main>
|
||||
{% if split | length < 2 %} {% set content=page.content %} {% else %} {% set content="" %} {% for part in split %} {% if
|
||||
part is starting_with("/blog") %} {% set split_part=part | split(pat='/">' ) %} {% set link=split_part[0] %} {% set
|
||||
link=link | replace(from="/blog/post" , to="/blog" ) %} {% set link=link | replace(from="_" , to="-" ) %} {% set
|
||||
rest_part=split_part | slice(start=1) | join(sep='/">' ) %} {% set part=link ~ '/">' ~ rest_part %} {% endif %} {% if
|
||||
loop.first %} {% set_global content=part%} {% else %} {% set_global content=content ~ "threefold.io" ~ part%} {% endif
|
||||
%} {% endfor %} {% endif %} <main>
|
||||
|
||||
<div class="container mx-auto mt-10">
|
||||
|
||||
<div>
|
||||
<article id="article" class="article lg:w-4/6 mx-auto">
|
||||
<article class="article lg:w-4/6 mx-auto">
|
||||
<h1 class="lg:text-5xl font-medium leading-none mt-0 text-gray-700">
|
||||
{{ page.title }}
|
||||
</h1>
|
||||
|
||||
<h4 class="text-2xl text-gray-600 leading-8">
|
||||
{{ page.description }}
|
||||
</h4>
|
||||
@@ -53,7 +37,8 @@
|
||||
<ul class="list-none flex author-list m-0">
|
||||
<li class="author-list-item">
|
||||
{% if author %}
|
||||
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') | replace(from='index.md', to=author.extra.imgPath)) %}
|
||||
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') |
|
||||
replace(from='index.md', to=author.extra.imgPath)) %}
|
||||
<img src="{{author_img}}" alt="{{author.title}}" class="
|
||||
h-8
|
||||
w-8
|
||||
@@ -73,18 +58,18 @@
|
||||
<a href="{{author.permalink}}" class="text-gray-700 text-xs">{{ author.title }}</a>
|
||||
{% endif %}
|
||||
<p class="text-gray-700 text-xs">
|
||||
<time datetime="{{ page.date }}"> {{ page.date | date(format="%B %e, %Y", timezone="America/Chicago") }}</time>
|
||||
<time datetime="{{ page.date }}"> {{ page.date | date(format="%B %e, %Y", timezone="America/Chicago")
|
||||
}}</time>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="my-2 sharethis-inline-share-buttons"></div>
|
||||
</section>
|
||||
{% set img_url = get_url(path='/' ~ page.relative_path | replace(from='_', to='-') | replace(from='index.md', to=page.extra.imgPath)) %}
|
||||
{% set img_url = get_url(path='/' ~ page.relative_path | replace(from='_', to='-') | replace(from='index.md',
|
||||
to=page.extra.imgPath)) %}
|
||||
<img class="mb-8 mx-auto" src={{img_url}} alt="{{page.title ~ 'Picture'}}">
|
||||
<div id="article">{{ content | safe }}</div>
|
||||
|
||||
|
||||
<div>{{ content | safe }}</div>
|
||||
<section class="post-tags container relative py-10">
|
||||
{% for tag in page.taxonomies.tags %}
|
||||
{% set fullpath = "/tags/" ~ tag | replace(from='_', to='-' ) %}
|
||||
@@ -109,6 +94,6 @@
|
||||
|
||||
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
|
||||
{% endblock content %}
|
||||
{% endblock content %}
|
||||
@@ -1,17 +1,19 @@
|
||||
{% if post.date %}
|
||||
{% if post.taxonomies.people %}
|
||||
{% set people = get_section(path="people/_index.md") %}
|
||||
{% set pages_str = people.pages | json_encode() | as_str %}
|
||||
{% if pages_str is containing(post.taxonomies.people[0]) %}
|
||||
{% set author_path = 'people/' ~ post.taxonomies.people[0] ~ '/index.md' %}
|
||||
{% set author = get_page(path=author_path) %}
|
||||
{% endif %}
|
||||
{% set people = get_section(path="people/_index.md") %}
|
||||
{% set pages_str = people.pages | json_encode() | as_str %}
|
||||
{% if pages_str is containing(post.taxonomies.people[0]) %}
|
||||
{% set author_path = 'people/' ~ post.taxonomies.people[0] ~ '/index.md' %}
|
||||
{% set author = get_page(path=author_path) %}
|
||||
{% set content = get_page(path=author_path) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="flex flex-col rounded-lg shadow-lg overflow-hidden">
|
||||
<div class="flex-1 border-b">
|
||||
<a href="{{ post.permalink }}" class="block">
|
||||
{% set img_url = get_url(path='/' ~ post.relative_path | replace(from='_', to='-') | replace(from='index.md', to=post.extra.imgPath)) %}
|
||||
{% set img_url = get_url(path='/' ~ post.relative_path | replace(from='_', to='-') | replace(from='index.md',
|
||||
to=post.extra.imgPath)) %}
|
||||
<div class="flex-shrink-0">
|
||||
<img class="h-48 w-full mx-auto object-cover" src={{img_url}} alt="{{post.title ~ ' Picture'}}" />
|
||||
</div>
|
||||
@@ -25,15 +27,16 @@
|
||||
{{ post.description }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
<div class="article hidden">{{ post.content | safe }}</div>
|
||||
|
||||
<div class="w-full post-card-meta py-3">
|
||||
<div class="avatars">
|
||||
<div class="flex items-center">
|
||||
<div class="flex justify-between items-center">
|
||||
<ul class="list-none flex author-list mr-2">
|
||||
<div class="flex">
|
||||
<div class="flex">
|
||||
<ul class="list-none flex author-list mr-2 pl-0">
|
||||
{% if author %}
|
||||
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') | replace(from='index.md', to=author.extra.imgPath)) %}
|
||||
{% set author_img = get_url(path='/' ~ author.relative_path | replace(from='_', to='-') |
|
||||
replace(from='index.md', to=author.extra.imgPath)) %}
|
||||
<li class="author-list-item"><img alt="{{author.title}}" src="{{author_img}}"
|
||||
class="w-8 h-8 rounded-full bg-gray-200 border-2 border-white"></li>
|
||||
{% endif %}
|
||||
@@ -48,10 +51,17 @@
|
||||
{{ post.date | date(format="%B %e, %Y", timezone="America/Chicago") }}
|
||||
</time>
|
||||
</p>
|
||||
<p class="flex justify-between lowercase my-2 items-center text-gray-700 text-xs"><span id="time"
|
||||
class="time"></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user