Avatar

Organizations

1 results for Github Action
  • 设置流程

    1. 自定义域名

    • 在"theme/<YouThemeName>/static"目录下,添加CNAME文件,里面放自定义的域名
    blog.cuile.com
    

    上传后,Settings > Pages > Custom domain 设置中会出现自定义的域名

    • 修改 baseurl
    # config/_default/config.toml
    ...
    baseurl = "https://blog.cuile.com/"
    ...
    

    2. GitHub Pages 设置

    • Settings > Pages > Build and deployment > Source
      • 选择 “Deploy from a branch”
    • Settings > Pages > Build and deployment > Branch
      • 选择 “gh-pages” & “/(root)”

    其它不过多说明了,网上教程非常多,可以找来看。

    参考文档

    各种坑位

    1. 网页正常部署后,访问时页面却无法正常显示,部局完全是乱的。

    这可能是https请求报"block:mixed-content"错误导致的,是浏览器不允许在https页面里嵌入http的请求,现在高版本的浏览器为了用户体验,都不会弹窗报错,只会在控制台上打印一条错误信息。

    解决这个问题,可以从以下2点入手:

    • 在"theme/<YouThemeName>/layouts/partials/head.html"文件内,添加代码
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    

    https请求报错block:mixed-content问题的解决办法

    • 确保config.toml文件内,“baseUrl"的值与实际地址一致。

    2. config.toml 里的 theme 值,要与主题文档夹名一致,不然可能会导致主题无法应用的问题。

    3. Github Actions 设置

    • “Setup Hugo"项目里,标准版本与扩展版本的参数写法不一样。
    # 使用扩展版本
    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2
      with:
        hugo-version: '0.92.0'
        extended: true
    
    # 使用标准版本
    - name: Setup Hugo
      uses: peaceiris/actions-hugo@v2
      with:
        hugo-version: 'latest'
    

    GitHub Actions for Hugo

    Hugo Github Action Blog Created Fri, 14 Jan 2022 17:15:06 +0800