github-cards icon indicating copy to clipboard operation
github-cards copied to clipboard

1.0.5 version is broken

Open HarshadRanganathan opened this issue 6 years ago • 2 comments

  1. The template files are available under jsdelivr/cards/default.html. However, it's trying to access them via https://cdn.jsdelivr.net/gh/lepture/[email protected]/cards/default.html resulting in below error.
Couldn't find the requested file /cards/default.html in lepture/github-cards.

This can be fixed by using below meta tag

<meta name="gc:url" content="https://cdn.jsdelivr.net/gh/lepture/[email protected]/jsdelivr/cards/default.html">

Alternatively, proper fix would be via generate.py script to replace below code when generating jsdelivr scripts to have the card path as jsdelivr/cards/

cardurl = base + 'cards/' + theme + '.html';
  1. Jsdelivr serves html files with content-type as text/plain for security reasons. So, the iframe is loaded with html content instead of the card.

HarshadRanganathan avatar Oct 20 '19 19:10 HarshadRanganathan

I found out that when you use the URL generated from the demo it works.

URL from demo:

<div class="github-card" data-github="lepture/github-cards" data-width="400" data-height="" data-theme="default"></div>
<script src="//cdn.jsdelivr.net/github-cards/latest/widget.js"></script>

URL from readme:

<div class="github-card" data-user="lepture" data-repo="github-cards"></div>
<script src="https://cdn.jsdelivr.net/gh/lepture/github-cards@latest/jsdelivr/widget.js"></script>

ysfaran avatar Mar 27 '20 11:03 ysfaran