很多文章詳細闡述了個性化個人Profile說明的方法,卻鮮有提到如何實時更新最新博客博文并生成鏈接的方法,
其實不需要本地配置任何東西,只需要在倉庫加上特定的檔案,Github就會自動讀取這個檔案并轉換成相應的動作(Action),
方法參考自GitHub Profile README Generator - Dynamic Latest Blog Posts
首先配置好博客網站的訂閱,以RSS格式或者Atom格式輸出,要能從互聯網HTTP方式或HTTPS方式訪問得到,
在個人說明倉庫(和用戶名同名)添加.github目錄,再從.github目錄添加workflows目錄,再從.github/workflows目錄添加blog-post-workflow.yml這個檔案,
檔案內容如下:
name: Latest blog post workflow
on:
schedule:
# 每個小時自動獲取一次
- cron: "0 * * * *"
jobs:
update-readme-with-blog:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gautamkrishnar/blog-post-workflow@master
with:
max_post_count: "5" # 獲取幾條鏈接
feed_list: "https://no5972.tk/cms/feed.xml" # 改成博客訂閱的地址,以RSS格式或者Atom格式輸出的
編輯自己的說明檔案README.md,在需要生成鏈接的地方添加如下內容,
<!-- BLOG-POST-LIST:START -->
<!-- BLOG-POST-LIST:END -->
過幾個小時再看看自己的Profile頁面,看看相應內容是不是已經出現了博文的鏈接?

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/252072.html
標籤:AI
下一篇:報錯FutureWarning: Passing (type, 1) or ‘1type‘ as a synonym of type is deprecated; in a future ver...
