Search code examples
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...

    <!-- HTML Meta Tags -->
    <title>title_here</title>
    <meta name="description" content="description_here">
    
    <!-- Facebook Meta Tags -->
    <meta property="og:url" content="path_to_website_here">
    <meta property="og:type" content="website">
    <meta property="og:title" content="title_here">
    <meta property="og:description" content="description_here">
    <meta property="og:image" content="path_to_image_here">
    
    <!-- Twitter Meta Tags -->
    <meta name="twitter:card" content="summary_large_image">
    <meta property="twitter:domain" content="domain_here">
    <meta property="twitter:url" content="path_to_website_here">
    <meta name="twitter:title" content="title_here">
    <meta name="twitter:description" content="description_here">
    <meta name="twitter:image" content="path_to_image_here">
    

    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

    Previews on different sites.