Github自定义首页

Github自定义首页

原文地址:https://zhuanlan.zhihu.com/p/180550738

今天摸鱼之余,看到某个高中生的 GitHub 首页,让人眼前一亮

img

Google 一番,原来 GitHub 在上个月就推出了自定义首页这个功能。并且结合 GitHub Action,可以有非常多的玩法,甚至可以显示 Twitter 、微博以及豆瓣的相关动态。

下面是 Profile 的制作教程。

创建 Repo

首先新建一个仓库,仓库的名称需要和用户名一致。如果填写正确,会出现绿色的提示框,提示你正在创建一个 GitHub profile。

img

注意将仓库仓库设置为 Public,并选择初始化一个 README 文件,点击 Create repository 按钮创建仓库。

创建好后,页面会自动跳转到仓库主页,点击右上角的 Edit README 开始制作。

img

定制页面

内容方面,GitHub 给出了默认的欢迎内容,同时提供了一些建议和提示,这一部分默认被注释掉了。

### Hi there  
<br/><!--**Mayandev/Mayandev** is a ✨ _special_ ✨ repository because its `README.md` (this file) appears on your GitHub profile.
<br/>Here are some ideas to get you started:
<br/>-   I’m currently working on ...<br/>-   I’m currently learning ...<br/>-   I’m looking to collaborate on ...<br/>-   I’m looking for help with ...<br/>-   Ask me about ...<br/>-   How to reach me: ...<br/>-   Pronouns: ...<br/>- ⚡ Fun fact: ...<br/>-->

你可以删除这个注释,或者按照这个模板来进行编写相关的介绍。

另外也可选择一些更加个性化的展示方式。

仓库统计信息

在 README 中加入下面的代码,可以清晰明了的展示自己仓库统计信息。

![](https://github-readme-stats.vercel.app/api?username=mayandev)

注意将 username 后面的参数改为自己的用户名。上面的代码会渲染出类似下面的图片:

img

传入 &theme=dark 参数会显示暗色的图片。

![](https://github-readme-stats.vercel.app/api?username=mayandev&theme=dark)

img

如果你熟悉 Markdown[1] 语法或者 HTML 的话,你还可以再此基础上进行样式上的设置。

使用徽标

使用徽标可以使得主页更加吸引眼球,可以在 http://shield.io[2] 搜索找到你想要的图标。

img

徽标相关可以参考 @moshfiqrony[3] 的个人介绍。

img

代码统计

代码统计需要运行 GitHub Action,GitHub 的相关教程可以先参考阮一峰老师的 GitHub Actions 入门教程[4]

首先打开WakaTime[5] 网站,使用 GitHub 登录,在首页会生成一个密钥。然后,将这个密钥储存到当前仓库的 Settings/Secrets 里面,我这里命名为 WAKATIME_API_KEY。

img

然后新建一个 Action,粘贴下面的代码:

name: WakaTime Readme

on:
  push:
    branches:
      - master
  schedule:
    - cron: '0 19 * * *'

jobs:
  update-readme:
    runs-on: ubuntu-latest
    steps:
      - uses: athul/waka-readme@master
        with:
          WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}

创建好后,GitHub 会根据 cron 配置的定时任务,定时运行上面的 Action,更新 README。

img

更多

更多玩法,你在 awesome-github-profile-readme[6] 仓库中找到 Profile 的更多玩法。

例如有的人在首页设置了一个游戏,其他用户通过提交 issue 参与游戏。也有人在首页定时更新自己的博客以及社交推送等等

以上是 GitHub Profile 的相关分享,希望对你有帮助。

参考资料

[1]

Markdown: https://guides.github.com/features/mastering-markdown/

[2]

shield.io: https://shields.io/

[3]

@moshfiqrony: https://github.com/moshfiqrony/moshfiqrony

[4]

GitHub Actions 入门教程: http://www.ruanyifeng.com/blog/2019/09/getting-started-with-github-actions.html

[5]

WakaTime: https://wakatime.com/

[6]

with-github-actions.html)*

[5]

WakaTime: https://wakatime.com/

[6]

awesome-github-profile-readme: https://github.com/abhisheknaii

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要使用自定义证书连接到Github Conpilot,你需要进行以下步骤: 1. 首先,你需要申请一个域名,并在域名管理后台添加域名转发(CNAME)到你的Github用户名.github.io。这样可以将你的域名与Github Pages绑定起来。 2. 接下来,你需要在DNS解析记录中添加一个解析记录,类型为A,主机记录为@,记录值为ping你的Github用户名.github.io的IP地址。这些IP地址可以选择其中一个:185.199.108.153,185.199.109.153,185.199.110.153,185.199.111.153。 完成上述步骤后,你就可以使用自定义证书连接到Github Conpilot了。请确保你的域名的证书与Github Conpilot的证书是相匹配的,并按照Github的指导进行配置。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Github Pages使用自定义域名](https://blog.csdn.net/qq_33411202/article/details/131685791)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [使用GitHub托管网站,自定义域名](https://blog.csdn.net/zh1442113005/article/details/128490837)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值