How can we show a random post on the website?
Jekyll is all static, so it cannot generate a random anything on its own, other than once when it builds.
You could probably output your posts into a json file, and then read that in with JS and have JS pick one randomly and display it. I’m not very good with JS so maybe there would be an easier way than that.
I found this which may be of use for you… Not needed it myself so not used it but might be just what you are after?
If you want a random post as a starting page, I would do this:
- Redirect to that item
If you want to show just an image, title and short description, I would do:
- Show them on the screen
A live example of this method is this website: http://springtijarchitecten.nl/, source: https://github.com/jhvanderschee/springtijarchitecten, and this website: https://www.usecue.com, source: https://github.com/jhvanderschee/usecuewebsite.