piotrl / github-profile-card

Simple and easy to use widget with your GitHub profile — No dependencies
https://piotrl.github.io/github-profile-card
MIT License
96 stars 10 forks source link

Not show Multiple Person Profile #17

Closed devangbhuva97 closed 7 years ago

devangbhuva97 commented 7 years ago

I want to try display multiple person profile but only one person profile displayed. Reason: Data only come in first profile. There is no data in second profile.

code-1 code-2 output-1 output-2

piotrl commented 7 years ago

Hi Devang, I'm glad you took the time to report this. Thanks!

It's a bug, I do cache requests to avoid GitHub API limitations and I naively assumed that only one profile will be displayed.

I'm gonna fix it and release version 2.0.2.

devangbhuva97 commented 7 years ago

thank and all the best for fix bug

piotrl commented 7 years ago

@devangbhuva97 I was wrong. It's not a bug actually ;)

Only one widget is rendered because in HTML id="github-profile" is used twice. On one page, id attribute has to be unique (according to HTML specification). Every next element with the same id is ignored.

Solution for you

HTML (only changed IDs)

<div id="github-card-1"
         data-max-repos="1"
         data-username="JimishF">
</div>
<div id="github-card-2"
         data-max-repos="1"
         data-username="devangbhuva97">
</div>

JavaScript (you have to initialize widgets with custom template)

new GitHubCard({
    template: '#github-card-1'
}).init();

new GitHubCard({
    template: '#github-card-2'
}).init();

Let me know if that works for you.

devangbhuva97 commented 7 years ago

Thank you so much for giving solution.