amp-gist

Edit on Github
Open in Playground

Experimental Mode

This example uses the following experimental feature: [amp-gist]. Enable the experiment via the button below. Some components require the AMP Dev Channel to be enabled as well. Learn more here.

Enable Dev Channel

Introduction

The amp-gist component allows embedding of an entire gist or a single file. The fixed-height layout is the only supported layout, and it requires the height attribute. You must provide the actual height of the gist, and you can find this on the gist page by inspecting the element with developer tools (e.g. Chrome Dev Tools).

Read the official amp-gist documentation. Visit GitHub Gist to create a Gist.

Setup

Import the amp-gist component

<script async custom-element="amp-gist" src="https://cdn.ampproject.org/v0/amp-gist-0.1.js"></script>

Basic Usage

Embed an entire gist.

Example

<amp-gist data-gistid="b9bb35bc68df68259af94430f012425f"
  layout="fixed-height"
  height="241">
</amp-gist>

Embed one file out of a gist using the data-file attribute. The data-file attribute is optional.

Example

<amp-gist data-gistid="a19e811dcd7df10c4da0931641538497"
  data-file="hi.c"
  layout="fixed-height"
  height="197">
</amp-gist>