關鍵字:disable Vercel bot; disable Preview Deployments
Vercel是一個支持部署前端框架和靜態網站的平臺。你可以方便的把 Github Pages 上面的站點導入Vercel,這樣做有兩個好處:
- 有些地區有些時候,Vercel上面的站點比Github Pages上的訪問速度快;
- Github Pages 屏蔽了百度的爬蟲,因此你的博客不能被百度檢索到。但 Vercel 是可以的。
使用了一段時間的Vercel,發現有兩個地方需要調整。
關閉評論
每次提交後,vercel bot會在該commit下評論:
這造成了大量的github通知和郵件通知:
如何關閉?在站點根目錄新增vercel.json
文件,內容如下:
{
"github": {
"silent": true
}
}
禁止Preview Deployments
另一個需要關閉的就是Preview Deployments(與我而言)。我的站點沒有預覽的必要,都是直接build main分支然後上production。Preview Deployments 構建的是gh-pages
分支,可能是我哪裏沒弄對,這個分支一直無法build成功。如下圖,2小時過去了還沒結束,然後我手動取消了。
因此,我禁止了Preview Deployments,直允許Production Deployments。操作如下:
Project Settings -> Git -> Ignored Build Step,在 COMMAND 填入 [ "$VERCEL_ENV" != production ]
。
Reference
- How do I prevent the Vercel for GitHub integration comments? – Vercel Docs
- Using Vercel without preview deployments (codejam.info)
本文同步發佈於: