Edit On Github Link

Updated 2 months ago

Code

Dependencies

  • Primitives: color only.
  • Assets: none.

HTML recipe

<a class="ps-edit-link" href="{{githubSourceUrl}}" target="_blank" rel="noopener noreferrer">Edit this page on GitHub</a>

rel="noopener noreferrer" is mandatory — it prevents the new tab from accessing window.opener.

Constructing {{githubSourceUrl}}

Not yet implemented in the rendering app (see Usage — Status). The URL should be built from the same two fields the substrate's own theme already publishes for exactly this purpose, themes/pointsav-brand.json's github block:

"github": {
  "repo": "https://github.com/pointsav/pointsav-design-system",
  "edit_path_prefix": "edit/main/dtcg-vault"
}

i.e. {repo}/{edit_path_prefix}/<path-to-current-page's-source-file> — for example, this very page would resolve to https://github.com/pointsav/pointsav-design-system/edit/main/dtcg-vault/components/edit-on-github-link/usage.md.

Important Information

Design System disclosure

This site provides open-source design tokens, documentation, and self-hostable software published by Woodfine Capital Projects Inc. Information here is for general reference only and does not constitute an offer, warranty, or a guarantee of fitness for any particular purpose. Statements regarding planned, intended, or targeted future features are forward-looking and subject to change without notice; they are not undertaken to be updated except as required by law.