Search code examples
htmldiscordembedgithub-pages

Discord Link Embed with GitHub Pages


I'm trying to insert embed in my website hosted on GitHub Pages, but idk how I put it to show an embed when the website link is sent to a Discord channel, is it possible, if yes, how I can do it? exist a code for that? it can be configured on the GitHub Pages Tab?


Solution

  • yes there is a way to do it specificly for discord, it's pretty simple actually!

    <meta property="og:type" content="website">
    <meta property="og:site_name" content="NAME_HERE">
    <meta property="og:description" content="DESC_HERE">
    <meta property="og:footer" content="FOOTER_HERE">
    <meta name="theme-color" content="COLOR_HERE">
      
    <link type="application/json+oembed" href="embed.json">
    

    you use it as a normal embed so if you wanna add an image to it you just add

    <meta property="og:image" content="IMAGE_LINK_HERE">
    

    you might see I require a json file too and you can create one if you want and define things such as provider_url. You can have your json file like this for example

    {
        "type": "object",
        "author_name": "",
        "author_url": "",
        "provider_name": "",
        "provider_url": ""
    }