Last active
January 29, 2023 07:32
-
-
Save jasalt/91ee171ba9b41aad0dbf2c6cd1eaf10f to your computer and use it in GitHub Desktop.
HTML / JS to embed Github starred repos on web site [WordPress Compatible]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script> | |
<div class="gh-starred-repos"></div> | |
<script> | |
var urlToGetLatestStarredRepos = "https://api.github.com/users/jasalt/starred?per_page=10"; | |
jQuery(document).ready(function () { | |
jQuery.getJSON(urlToGetLatestStarredRepos, function (allRepos) { | |
jQuery.each(allRepos, function (i, repo) { | |
var repoUrl = jQuery('<a style="color:red;"></a>').text(repo.full_name).attr('href', repo.html_url).appendTo(".gh-starred-repos"); | |
jQuery(".gh-starred-repos").append("<label> [" + repo.description + "]</label>" + " <i><strong>" + repo.language + "</strong> ⭐ " + repo.stargazers_count + " </i> "); | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ready to be inserted to Custom HTML block on WordPress page. Used in https://saltiolabs.com as example.