Show date of posts (#2526)

* add date to read-time.html

* add option for show_date, dynamic icon style

* change read-time to post__meta

* cleanup post__metal.html

* cleanup post__meta include variables

* put date before read time

* remove space in include variable

* allow customisation of post__meta separator

* add some documentation

* oops fix typo derp

* add post date image

* change page meta separator customisation to CSS
This commit is contained in:
Lim Jing Heng
2020-08-04 22:39:01 +08:00
committed by GitHub
parent 5d85bf1912
commit f15e02ea58
12 changed files with 150 additions and 24 deletions

View File

@@ -265,6 +265,26 @@ breadcrumbs: true # disabled by default
Breadcrumb start link text and separator character can both be changed in the [UI Text data file]({{ "/docs/ui-text/" | relative_url }}).
### Post dates
Enable post date snippets with `show_date: true` in YAML Front Matter.
![post date example]({{ "/assets/images/mm-post-date-example.png" | relative_url }})
Instead of adding `show_date: true` to each post, apply as a default in `_config.yml` like so:
```yaml
defaults:
# _posts
- scope:
path: ""
type: posts
values:
show_date: true
```
To disable post date for a post, add `show_date: false` its YAML Front Matter to override what was set in `_config.yml`.
### Reading time
Enable estimated reading time snippets with `read_time: true` in YAML Front Matter. `200` has been set as the default words per minute value --- which can be changed by adjusting `words_per_minute:` in `_config.yml`.
@@ -291,6 +311,20 @@ To disable reading time for a post, add `read_time: false` its YAML Front Matter
words_per_minute: 250
```
### Post meta separator
To customise the separator between the post date and reading time (if both are enabled), edit ```.post__meta-sep::before``` in a [custom stylesheet]({{ "/docs/stylesheets/" | relative_url }}).
For example,
```css
.post__meta-sep::before {
content: "\2022";
padding-left: 0.5em;
padding-right: 0.5em;
}
```
### Comments
[**Disqus**](https://disqus.com/), [**Discourse**](https://www.discourse.org/), [**Facebook**](https://developers.facebook.com/docs/plugins/comments), [**utterances**](https://utteranc.es/), and static-based commenting via [**Staticman**](https://staticman.net/) are built into the theme. First set the comment provider you'd like to use: