ruby-news / ruby-news.github.io

1 stars 4 forks source link

Ability to add automatic images with post titles on them #48

Closed Souravgoswami closed 3 years ago

Souravgoswami commented 3 years ago

Currently an article must have an index image. But we can change the behaviour and we can:

Technical Overview:

From User Perspective

If they don't provide the image, it will put a random image there that will not be changed ever, unless the post date is modified, or a new image is added. The image will also have a title on them. They don't have to think about anything, it's all automatic.

Souravgoswami commented 3 years ago

Hi @Sergyenko, based on date, we can generate a random unique image for each posts, that will retain forever until the date of the post is added / edited. It works even if the date value is missing.

Here in this image, I have commented out the dates and images of the posts, and it generates and adds random images (from a directory) for them:

image

So based on that random number, we can insert an image in the post, if the user misses the images. It will append the title to the image as well. What do you think?

[ This is not slow ]

Sergyenko commented 3 years ago

I really like the idea, let's make a short demo and see how it's going to fit

Souravgoswami commented 3 years ago

Hi, this commit adds the ability to add such random images to the posts. This only works when the preview_image: ... key is missing from the posts.