nielsenramon / chalk

Chalk is a high quality, completely customizable, performant and 100% free Jekyll blog theme.
http://chalk.nielsenramon.com
MIT License
1.22k stars 440 forks source link

Extract common article info footer into an include #180

Closed lehnerpat closed 4 years ago

lehnerpat commented 6 years ago

The article info footer (article date, "x minute read", and tags) occur in three places (article list, article view,and articles-by-tag).

This PR deduplicates the redundant code from these three places into a single include.

I created the include in a subfolder in _includes, because some more parts about the article layout bits can be extracted. If you like this kind of deduplication, I'd be happy to send more PRs in the future.

lehnerpat commented 6 years ago

I just noticed: this doesn't work right if a tag is used that doesn't have an entry in "my_tags". (If you do this, an empty entry is printed in the article's tag list.)

If you want to support this edge case, I can make the include more robust to handle it. Instead of looking up the tag's name from the collection, I'd suggest just using the specified tag itself in that case.

nielsenramon commented 4 years ago

Nice thanks!