Sponsor button embed ?

Hi,
Is it possible to embed the “Sponsor” button in a external webpage ? (That would be great)

Also, it would be awesome if it (in the same way it does on GitHub, when multiple sponsors are specified) allowed to specify multiple people. Clicking on it would show the same popup than in GitHub or redirect to the corresponding GitHub (not currently possible because there are no direct link to the sponsor button of a repository).

Thanks for your time

Thanks for the feedback! I’ve taken your suggestion and passed it along to the appropriate teams. Thanks again for reaching out :grinning:

5 Likes

To people looking for this: you can hack your way through by using the undocumented “funding_links” page. For instance

https://github.com/secdev/scapy/funding_links?fragment=1

But then you’ll need to import github css. You can probably download it from the source if it’s not copyrighted (I don’t expect things like https://github.githubassets.com/assets/frameworks-146fab5ea30e8afac08dd11013bb4ee0.css to remain live.) Maybe I’ll figure out a static link / gist someday.

1 Like

:wave: Hi, @gpotter2! Wanted to let you know that you can now embed a sponsor button on an external web page. To try it out, log into your Sponsors dashboard, and under “Share it out,” click “Embed it.”

1 Like

That’s very cool thanks !
Do you know if this also applies to repository-specific sponsor buttons ?

We haven’t built that yet, but it’s a great idea!

One approach you could try to build a repository-specific sponsor button that could be a little more resilient and flexible than using that funding_links HTML fragment you mentioned above is to fetch the data from the GraphQL API. Each Repository has a fundingLinks field that you can use like this.

query { 
  repository(name: "scapy", owner: "secdev") { 
    fundingLinks {
      platform
      url
    }
  }
}

That would return data that looks like this.

{
  "data": {
    "repository": {
      "fundingLinks": [
        {
          "platform": "GITHUB",
          "url": "https://github.com/gpotter2"
        },
        {
          "platform": "GITHUB",
          "url": "https://github.com/guedou"
        },
        {
          "platform": "GITHUB",
          "url": "https://github.com/p-l-"
        }
      ]
    }
  }
}

You can give it a shot yourself in the GraphQL API explorer if you’re interested.

If you really dig the CSS for the button, it’s open source as part of Primer, which you’re free to pull into your project.

Thanks again for the idea! :sparkles:

2 Likes