如何配置GitHub以使用不受支持的Jekyll站点插件?

如何配置GitHub以使用不受支持的Jekyll站点插件?,github,jekyll,github-pages,jekyll-extensions,Github,Jekyll,Github Pages,Jekyll Extensions,我刚刚为我的Jekyll博客创建了一个很棒的图库,它完全建立在我的localhost:4000上。但是,GitHub页面不支持我正在使用的Jekyll Gallery Generator插件: 我读到了关于使用FTP(上传_站点目录)在传统主机上托管Jekyll的替代方法,但是,与其重新配置我的整个站点和托管,不如使用GitHub页面,即使我使用的是不受支持的插件 解决方法是什么?取决于您是与用户/组织(UO)站点还是项目站点(p)打交道,请执行以下操作: 从您的工作文件夹git init gi

我刚刚为我的Jekyll博客创建了一个很棒的图库,它完全建立在我的localhost:4000上。但是,GitHub页面不支持我正在使用的Jekyll Gallery Generator插件:

我读到了关于使用FTP(上传_站点目录)在传统主机上托管Jekyll的替代方法,但是,与其重新配置我的整个站点和托管,不如使用GitHub页面,即使我使用的是不受支持的插件


解决方法是什么?

取决于您是与用户/组织(UO)站点还是项目站点(p)打交道,请执行以下操作:

  • 从您的工作文件夹
    git init
  • git远程添加源git@github.com:userName/userName.github.io.git
    UO)或
    git远程添加源git@github.com:userName/repositoryName.git
    P
  • jekyll new。
    创建您的代码库
  • 在_config.yml中,将baseurl参数设置为
    baseurl:“
    UO)或
    baseurl:“/repositoryName”(P
  • 在.gitignore add\u站点中,它将在另一个分支中进行版本控制
  • jekyll build
    将创建目标文件夹和生成站点
  • git checkout-b源
    UO)或
    git checkout master
    P
  • git add-A
  • git提交-m“jekyll base sources”
    提交您的源代码
  • git-push-origin-sources
    UO)或
    git-push-origin-master
    P)将源推送到相应的分支中
  • cd\u站点
  • touch.nojekyll
    ,此文件告诉gh页面无需构建
  • git init
    init存储库
  • git远程添加源git@github.com:userName/userName.github.io.git
    UO)或
    git远程添加源git@github.com:userName/repositoryName.git
    P
  • git checkout master
    UO)或
    git checkout-b gh pages
    P)将此存储库放在相应的分支上
  • git add-A
  • git提交-m“jekyll first build”
    提交您的站点代码
  • git-push-origin-master
    UO)或
    git-push-origin-gh-page
    P

  • 你现在有了类似的东西。看看他们的rake文件,里面有一些不错的评论

    更好的方法是将Travis配置为使用不受支持的插件自动部署jekyll。按照指南为您的回购启用Travis

    使用以下内容创建
    script/cibuild

    #!/usr/bin/env bash
    set -e # halt script on error
    
    bundle exec jekyll build
    touch ./_site/.nojekyll # this file tells gh-pages that there is no need to build
    
    使用以下内容创建
    .travis.yml
    (根据需要修改)

    部署步骤(每次推送后):

  • 将使用
    \u站点
    目录中的自定义脚本
    script/cibuild
    创建构建
  • \u站点
    将被推送到
    gh页面
    分支
  • github页面将按原样服务站点,而无需再次构建它(因为
    .nojekyll
    文件)

  • 参考:我的存储库正在使用Travis CI使用此方法进行持续集成

    谢谢David,回答得很好!我的网站现在正在使用您描述的工作流程运行库:但是,我想说的是,如果您使用自定义域(如我),即使项目页面baseurl也将保持为空白字符串。谢谢David。这是人生中令人惊奇的一步。宝贝,创造吧!这是一个非常详细的答案。但是在第15步中,如果是UO,你实际上不必
    git checkout master
    ,因为你将自动成为这个分支。如果你有这个设置,你如何保持master与sources文件夹的同步?你使用的是两个吗?每个分支机构一个?
    language: ruby
    rvm:
    - 2.3.3
    
    before_script:
     - chmod +x ./script/cibuild # or do this locally and commit
    
    # Assume bundler is being used, therefore
    # the `install` step will run `bundle install` by default.
    script: ./script/cibuild
    
    # branch whitelist, only for GitHub Pages
    branches:
      only:
      - master
    
    env:
      global:
      - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
    
    sudo: false # route your build to the container-based infrastructure for a faster build
    
    deploy:
      provider: pages
      skip_cleanup: true
      keep-history: true
      local_dir: _site/  # deploy this directory containing final build
      github_token: $GITHUB_API_KEY # Set in travis-ci.org dashboard
      on:
        branch: master