如何配置GitHub以使用不受支持的Jekyll站点插件?
我刚刚为我的Jekyll博客创建了一个很棒的图库,它完全建立在我的localhost:4000上。但是,GitHub页面不支持我正在使用的Jekyll Gallery Generator插件: 我读到了关于使用FTP(上传_站点目录)在传统主机上托管Jekyll的替代方法,但是,与其重新配置我的整个站点和托管,不如使用GitHub页面,即使我使用的是不受支持的插件如何配置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
解决方法是什么?取决于您是与用户/组织(UO)站点还是项目站点(p)打交道,请执行以下操作:
git init
git远程添加源git@github.com:userName/userName.github.io.git
(UO)或git远程添加源git@github.com:userName/repositoryName.git
(P)jekyll new。
创建您的代码库baseurl:“
(UO)或baseurl:“/repositoryName”(P)
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页面
分支.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