From 5c1a6047c9689b038d1dfab4e21fc27b9e915348 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 29 Aug 2022 08:40:36 -0700 Subject: [PATCH 1/3] Add reading time to post layout --- .gitignore | 7 +++++++ _includes/reading-time.html | 6 ++++++ _layouts/post.html | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 .gitignore create mode 100644 _includes/reading-time.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c8ca10 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +_site/ +.sass-cache/ +.jekyll-cache/ +.jekyll-metadata +# Ignore folders generated by Bundler +.bundle/ +vendor/ \ No newline at end of file diff --git a/_includes/reading-time.html b/_includes/reading-time.html new file mode 100644 index 0000000..0aedf2e --- /dev/null +++ b/_includes/reading-time.html @@ -0,0 +1,6 @@ +{% capture words %} +{{ content | number_of_words | minus: 180 }} +{% endcapture %} +{% unless words contains '-' %} +{{ words | plus: 150 | divided_by: 150 | append: ' minutes to read' }} +{% endunless %} \ No newline at end of file diff --git a/_layouts/post.html b/_layouts/post.html index 57db5bc..0150144 100755 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -48,6 +48,10 @@

{{ page.title | escape }}

+
+ + {% include reading-time.html %} +
From c8760897f22f7a822eca9952233e15c4cf5eb3db Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 1 Sep 2022 05:41:06 -0700 Subject: [PATCH 2/3] Updated CSS for reading-time in _post.scss --- _sass/4-layouts/_post.scss | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_sass/4-layouts/_post.scss b/_sass/4-layouts/_post.scss index cd664e4..071f83f 100644 --- a/_sass/4-layouts/_post.scss +++ b/_sass/4-layouts/_post.scss @@ -207,8 +207,16 @@ font-weight: 400; color: var(--text-alt-color); } + + .post__reading-time { + position: absolute; + width: 762px; + height: 252px; + font-weight: 500; + } } + .post, .page { max-width: 760px; From 54a5f710510eaf4684159264c6e1e2ddf6c3438f Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 3 Sep 2022 06:50:49 -0700 Subject: [PATCH 3/3] Made reading-time font the same size as the author font --- _sass/4-layouts/_post.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/_sass/4-layouts/_post.scss b/_sass/4-layouts/_post.scss index 071f83f..da5ca02 100644 --- a/_sass/4-layouts/_post.scss +++ b/_sass/4-layouts/_post.scss @@ -212,6 +212,7 @@ position: absolute; width: 762px; height: 252px; + font-size: 16px; font-weight: 500; } }