nunocoracao / blowfish

Personal Website & Blog Theme for Hugo
https://blowfish.page
MIT License
1.36k stars 381 forks source link

✨ GitHub Card to a specific Branch #1453

Open NikarashiHatsu opened 4 months ago

NikarashiHatsu commented 4 months ago

Is your feature request related to a problem? Please describe. At this point, we have the GitHub Card Shortcode that refer to a repository, but I do really want the feature to be extended to a specific branch / tags.

Describe the solution you'd like Using the GitHub API https://api.github.com/repos/username/repository/branches/branch should be enough. But since the API itself didn't provide the same key-value as the https://api.github.com/repos/username/repository, it might need both Requests to be send at the same time.

Describe alternatives you've considered At this point, I gave my audience the exact link to the repository. It works, but less style makes it so dull and bland.

Additional context None

nunocoracao commented 4 months ago

Thanks for your suggestions @NikarashiHatsu. I'll not have time to fix this one anytime soon, feel free to submit a PR and I can help review

wtchangdm commented 2 months ago

Since the GitHub card currently only shows name, stars, description, and forks. Linking to a specific tag/branch doesn't change its look.

So maybe we can just add a new property like ref (e.g., {{< github repo="user/repo" ref="dev" >}}) and just change the URL from something like:

https://github.com/nunocoracao/blowfish

to

https://github.com/nunocoracao/blowfish/tree/dev

in the line here

https://github.com/nunocoracao/blowfish/blob/1f08dcb9d27a4b3460a38b4d772c2e06935891e6/layouts/shortcodes/github.html#L7

Of course it can link to the wrong/nonexistent branch/tag but I think it's author's responsibility for make it right and we can save many requests.