Description
Rather than using the /raw
endpoint, if JEKYLL_GITHUB_TOKEN
is passed as an environmental variable, use the Gist API to retrieve the Gist content. This can be done directly, or via Octokit.gist [gist_id]
if you don't mind the extra dependency (since the Gem is no longer bundled by default).
The advantage here, other than using an API over a raw endpoint (for better error handling, proper response codes, etc.), is that it'd be going through an authenticated and rate-limited endpoint, meaning requests can be tracked, and there's less risk of accidental DDoS (as it can gracefully fallback if the rate limit is hit).
The downside is that it would not work for Gists > 1MB, but I suspect that's a major edge case for content being embedded in a site.
Glad to tackle if there's consensus on the best approach, if any.