darrenjennings / vuepress-plugin-reading-time

Vuepress reading time plugin to display how long a page takes to read
31 stars 2 forks source link

Help: reading time not appearing #3

Closed berot3 closed 5 years ago

berot3 commented 5 years ago

I hope my quesiton is not too stupid, but I would like to sue this plugin on my vuepress.

I added it to my plugins in config.js but I can't see it displayed anywhere. Does this mean that the theme has to support it or that I have to implement it into the theme somehow?

Thanks for any help!

darrenjennings commented 5 years ago

Vuepress is fully extensible so this plugin doesn't add any UI, it only injects the readingTime object into the $page global object. For instance, I have a custom theme for my blog that injects the time at the top of the posts layout:

https://github.com/darrenjennings/guuu.io/blob/master/docs/.vuepress/theme/Layouts/Post.vue#L5 https://github.com/darrenjennings/guuu.io/blob/master/docs/.vuepress/components/ReadingTime.vue#L3

You could also just access inside markdown:

---
permalink: /about
---

# About

This post is a {{ $page.readingTime.text }}