htmldiscordmetadatapreview

Discord/Twitter/others preview for link not working


I've been trying to make a preview for my website images, on cdn.luckiecrab.nl and I've asked few people and they tried to help me but it didn't work. So the current code I have in my <head> tag is https://srcb.in/WkIJoS2DrX but it doesn't load a preview on Discord. Tho someone else helped me with the above code, they have the exact same and at them a preview does load on Discord.

But I have exactly the same! https://media.discordapp.net/attachments/272764566411149314/920237218373713961/unknown.png?width=1440&height=514

Why for them does a preview load, but for me it won't, and how I can fix it?


Solution

  • I have a solution. The below will give you your preview. Obviously change the details...

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <meta name="description" content="Im Danial Ahmed and this is my personal 
    website">
    <meta name="twitter:image:src" content="https://i.imgur.com/VjUU72S.png">
    <meta name="twitter:image:src" content="https://i.imgur.com/VjUU72S.png">
    <meta name="twitter:site" content="@unofficialdxnny">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="unofficialdxnny (Danial Ahmed) 
    Website">
    <meta name="twitter:description" content="Im Danial Ahmed and this is my 
    personal website">
    <meta property="og:image" content="https://i.imgur.com/VjUU72S.png">
    <meta property="og:image:alt" content="Im Danial Ahmed and this is my 
    personal website">
    <meta property="og:image:width" content="1200">
    <meta property="og:image:height" content="600">
    <meta property="og:site_name" content="unofficialdxnny">
    <meta property="og:type" content="object">
    <meta property="og:title" content="unofficialdxnny (Danial Ahmed) Website">
    <meta property="og:url" content="https://unofficialdxnny.netlify.app">
    <meta property="og:description" content="Im Danial Ahmed and this is my 
    personal website">
    <meta name="expected-hostname" 
    content="https://unofficialdxnny.netlify.app/">
    

    Edit: You would obviously need to edit the details between the ""

    This is what the embeds will look like on some popular social networking sites

    Discord:
    Discord Embed

    Whatsapp:
    enter image description here

    Snapchat
    enter image description here