The AMP by Example Playground editor automatically adds <script>
elements for
components detected in the HTML source. For example, adding a <amp-sidebar>
element to the source adds the following child element to <head>
:
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
The mapping of component HTML element names to versions is derived by parsing definitions in the ampproject source on GitHub, using the GitHub API.
Use of this API requires the use of a token in order to avoid rate limiting associated with unauthenticated requests.
To create and store a token for a deployed instance of AMP by Example:
- In your GitHub profile, navigate to Settings > Developer settings.
- Click on Personal access tokens then Generate new token.
- No additional scopes are required before clicking Generate token.
- Create a new entity in Datastore:
- Set the Kind to
GitHubApiToken
- Set the Key identifier to Custom name with value
GitHubApiTokenKey
- Add a property with Name
AuthKey
and Value set to the token obtained from GitHub.
- Set the Kind to
- If this has been successful, no warnings will be present in the logs where requests are made to GitHub, bearing in mind that such requests only occur daily.