Commit e4f3368
Replace smart_truncate with Gem
In d86e1a2, we introduced post previews on the homepage (so you get a
preview on the homepage, but have to visit the post itself to continue
reading). To do so, we added a Jekyll "plugin" which is actually just a
single ruby file -- `smart_truncate.rb`. (This plugin is open source and
came from https://yingtongli.me/git/smart_truncate/tree/smart_truncate.rb.)
That plugin works, but I was disappointed there wasn't an easier way to
do this (a built-in Jekyll feature or a plugin distributed as a gem).
So, I built my own
[jekyll_html_truncatewords](https://github.com/mkasberg/jekyll_html_trunctewords)
plugin. This plugin is distributed as a gem and has better unit test
coverage than the `smart_truncate.rb` file (which had no apparent unit
tests), so I feel better about using it. My intent is to make this a
reliable and well-maintained Jekyll plugin for use here and for anyone
else who wants to use it.
In this commit, I remove the `_plugins/smart_truncate.rb` file and
replace it with my `jekyll_html_truncatewords` gem. The functionality is
identical, and I spot-checked several rendered HTML pages which look
identical with either plugin. The end result is that we don't have to
maintain a copy of that `smart_truncate.rb` file and instead we can
update the gem like we would for any other Jekyll gem/plugin.1 parent aaf0e7e commit e4f3368
4 files changed
Lines changed: 14 additions & 150 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | | - | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
This file was deleted.
0 commit comments