Skip to content

Commit

Permalink
Implement per-page reading-time stats
Browse files Browse the repository at this point in the history
Does not rely on Jekyll plugin but uses pure Liquid
Included basic CSS

Signed-off-by: Misty Stanley-Jones <[email protected]>
  • Loading branch information
Misty Stanley-Jones committed Nov 30, 2016
1 parent 0355aef commit 1cb25b9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _includes/read_time.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<span class="reading-time" title="Estimated reading time">
<span class="reading-time-label">Estimated reading time: </span>
{% assign words = content | number_of_words %}
{% if words < 360 %}
1 minute
{% else %}
{{ words | divided_by:180 }} minutes
{% endif %}
</span>
1 change: 1 addition & 0 deletions _layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
<section class="section" id="DocumentationText">
{% if page.title %}<h1>{{ page.title }}</h1>{% endif %}
{% if page.advisory %}<blockquote><p><strong style="color:black">{{ site.data.advisories.texts[page.advisory] }}</strong></p></blockquote>{% endif %}
{% include read_time.html %}
{{ content }}
{% if page.noratings != true %}
<div style="text-align: center; margin-top: 50px">
Expand Down
14 changes: 14 additions & 0 deletions css/documentation.css
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,17 @@ color: #F04124;
}

/* end search */

/* begin reading_time */

span.reading-time {
font-style: italic;
font-size: 80%;
display: block;
padding-top: 10px;
padding-bottom: 10px;
color: #999;
}

span.reading-time-label {
}

0 comments on commit 1cb25b9

Please sign in to comment.