[英]How do I configure GitHub to use non-supported Jekyll site plugins?
I just created a great gallery for my Jekyll blog which builds perfectly on my localhost:4000.我刚刚为我的 Jekyll 博客创建了一个很棒的画廊,它完美地构建在我的 localhost:4000 上。 However, GitHub pages doesn't support the Jekyll Gallery Generator plug-in I am using: https://github.com/ggreer/jekyll-gallery-generator
但是,GitHub 页面不支持我使用的 Jekyll Gallery Generator 插件: https : //github.com/ggreer/jekyll-gallery-generator
I read about the alternative method of hosting Jekyll on a traditional host using FTP (uploading the _site directory) http://jekyllrb.com/docs/deployment-methods/ However, rather than reconfigure my entire site and hosting, It would be great if GitHub Pages could be used somehow even though I'm using a non-supported plugin.我阅读了使用 FTP 在传统主机上托管 Jekyll 的替代方法(上传 _site 目录) http://jekyllrb.com/docs/deployment-methods/但是,与其重新配置我的整个站点和托管,不如说它会很棒如果 GitHub Pages 可以以某种方式使用,即使我使用的是不受支持的插件。
What is a workaround for this?什么是解决方法?
Depending if you deal with a User/Organization ( UO ) site or a Project site ( P ), do :取决于您处理的是用户/组织 ( UO ) 站点还是项目站点 ( P ),请执行以下操作:
git init
git init
git remote add origin git@github.com:userName/userName.github.io.git
( UO ) or git remote add origin git@github.com:userName/repositoryName.git
( P ) git remote add origin git@github.com:userName/userName.github.io.git
( UO ) 或git remote add origin git@github.com:userName/repositoryName.git
( P )jekyll new .
creates your code basebaseurl: ''
( UO ) or baseurl: '/repositoryName'
( P )baseurl: ''
( UO ) 或baseurl: '/repositoryName'
( P )jekyll build
will create the destination folder and build site. jekyll build
将创建目标文件夹和构建站点。git checkout -b sources
( UO ) or git checkout master
( P ) git checkout -b sources
( UO ) 或git checkout master
( P )git add -A
git commit -m "jekyll base sources"
commit your source code git commit -m "jekyll base sources"
提交你的源代码git push origin sources
( UO ) or git push origin master
( P ) push your sources in the appropriate branch git push origin sources
( UO ) 或git push origin master
( P ) 在适当的分支中推送你的源代码cd _site
touch .nojekyll
, this file tells gh-pages that there is no need to build touch .nojekyll
,这个文件告诉 gh-pages 不需要构建git init
init the repository git init
初始化存储库git remote add origin git@github.com:userName/userName.github.io.git
( UO ) or git remote add origin git@github.com:userName/repositoryName.git
( P ) git remote add origin git@github.com:userName/userName.github.io.git
( UO ) 或git remote add origin git@github.com:userName/repositoryName.git
( P )git checkout master
( UO ) or git checkout -b gh-pages
( P ) put this repository on the appropriate branch git checkout master
( UO ) 或git checkout -b gh-pages
( P ) 将此存储库放在适当的分支上git add -A
git commit -m "jekyll first build"
commit your site code git commit -m "jekyll first build"
提交你的站点代码git push origin master
( UO ) or git push origin gh-pages
( P ) git push origin master
( UO ) 或git push origin gh-pages
( P ) You now have something like Octopress does.你现在有像Octopress那样的东西。 Look at their rake file, there are some nice comments inside.
看看他们的 rake 文件,里面有一些不错的评论。
Better way is to configure Travis to automate deployment of jekyll with non-supported plugins.更好的方法是配置 Travis 以使用不受支持的插件自动部署 jekyll。 Follow Travis getting started guide to enable Travis for your repo.
按照Travis 入门指南为您的存储库启用 Travis。
Create script/cibuild
with the following content使用以下内容创建
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
Create .travis.yml
with the following content (modify as required)使用以下内容创建
.travis.yml
(根据需要修改)
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
Deployment steps (after every push):部署步骤(每次推送后):
script/cibuild
in _site
directory_site
目录中的自定义脚本script/cibuild
创建构建_site
will be pushed to gh-pages
branch. _site
将被推送到gh-pages
分支。.nojekyll
file) .nojekyll
文件) Reference: My repository https://github.com/armujahid/armujahid.me/ is using this method for continuous integration using Travis CI参考:我的存储库https://github.com/armujahid/armujahid.me/正在使用这种方法使用 Travis CI 进行持续集成
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.