How to make a Website that always embeds as an image when pasted onto discord

I am trying to make a website using NodeJS that always embeds into discord as an image no matter what the URL path is.

This means if I typed the website as “https://example.com/“ it would embed as the same image as if I typed “https://example.com/test/kenfossjdkskwndlw/test”.

I have tried creating a 404 image that is the image I want. I did this because I noticed if I upload an image to the site and then type out the name of the image I want on the URL path, it embeds properly. Creating this 404 page did nothing and the link still did not embed.

Hey, @me7474 welcome to the forums!

Can you please share a link to your repl?

1 Like

Do you want to get an image of how website looks when loaded, like a screenshot?

Edit: Is it onebox, what you need? Something like this:

1 Like

https://replit.com/@me7474/tenome7474?v=1

All that the replit currently is is a blank HTML project with an image uploaded into it.

I have an image I have uploaded onto the site. When you post a link that goes directly to an image file on discord, it removes the link and instead just shows the image. an example would be if I posted a raw Imgur image link. If the image ID was valid and it led to a gif/jpeg/png, discord would just hide the link and show the image.

I have gotten this to work on my site by doing “https://ReplitProject.me7474.repl.co/Image.png” I would like for the image to show no matter what the URL path is though, so if someone types “https://ReplitProject.me7474.repl.co/ThisIsaNotValidImageThatDoesNotExist” it still shows the image even though that is not the proper path to the image.

make a 301 redirect for all routes to that image