GitHub 个页面无法识别我的 Liquid 标签
My Liquid tag is not recognized by GitHub pages
我使用 Jekyll 3.8.5 并在 GitHub 上建立了一个博客。我还使用了 Jekyll-Katex 0.3.0,这是一个 Jekyll 插件,用于通过 KaTeX 轻松进行服务器端数学渲染。在我的本地机器上一切正常。但是当我把它推到 GitHub 时,我得到了这个:"Your site is having problems building: The tag Katexmm on line 11 in _posts/2019-01-22-ECDSA-and-Bitcoin-I.md is not a recognized Liquid tag."
"Katexmm" 是一个 liquid tag of Jekyll-Katex, so I checked dependencies. Jekyll-Katex 0.3.0 requires Jekyll ~> 3.8 while GitHub Pages uses Jekyll 3.7.4。我想这就是问题所在。
我该怎么办?
还有一件事:我想使用 "katexmm",请不要建议我使用 Jekyll 3.7.4 而不是 3.8.5。
提前致谢。
我听从了 ashmaroli 的建议,但还是不行。我尝试了 Nelify 和 "Deploy failed":
11:31:01 AM: Build ready to start
11:31:03 AM: build-image version: 84aca9ba39e0ee86ba194760fbfc51a808f62543
11:31:04 AM: buildbot version: 57d44fd1631cc3fff8b38fbaf88d3d04f946418a
11:31:04 AM: Fetching cached dependencies
11:31:04 AM: Starting to download cache of 254.7KB
11:31:04 AM: Finished downloading cache in 147.184771ms
11:31:04 AM: Starting to extract cache
11:31:04 AM: Failed to fetch cache, continuing with build
11:31:04 AM: Starting to prepare the repo for build
11:31:04 AM: No cached dependencies found. Cloning fresh repo
11:31:04 AM: git clone https://github.com/Jun-Wang-2018/Blog
11:31:05 AM: Preparing Git Reference refs/heads/gh-pages
11:31:06 AM: Starting build script
11:31:06 AM: Installing dependencies
11:31:08 AM: Downloading and installing node v8.15.0...
11:31:08 AM: Downloading https://nodejs.org/dist/v8.15.0/node-v8.15.0-linux-x64.tar.xz...
11:31:08 AM: 0.0%
11:31:08 AM:
######
11:31:08 AM: 8.4%
11:31:08 AM:
#############################################
11:31:08 AM: ### 66.8%
11:31:08 AM:
######################################
11:31:08 AM: ################################## 100.0%
11:31:08 AM: Computing checksum with sha256sum
11:31:08 AM: Checksums matched!
11:31:11 AM: Now using node v8.15.0 (npm v6.4.1)
11:31:12 AM: Attempting ruby version 2.3.6, read from environment
11:31:13 AM: Using ruby version 2.3.6
11:31:15 AM: Using PHP version 5.6
11:31:15 AM: Started restoring cached ruby gems
11:31:15 AM: Finished restoring cached ruby gems
11:31:15 AM: Installing gem bundle
11:31:15 AM: You must use Bundler 2 or greater with this lockfile.
11:31:15 AM: Error during gem install
11:31:15 AM: Error running command: Build script returned non-zero exit code: 1
11:31:15 AM: Failing build: Failed to build site
11:31:15 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:31:15 AM: Finished processing build request in 11.629358799s
我试过 Cloudcannon 和 "Jekyll build failed":
Syncing raw files... done
Checking existing local bundle state... failed
Loading gem cache...
Checking gem cache (bundle_cache/A16MrNFnrU9wWPnsPr5G8PkR_kBFEHG0ytrPjGtZ7mQ.zip)... no cache
$ export JEKYLL_ENV="production"
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
$ bundle -v
Bundler version 1.16.6
$ bundle config --global jobs 4
Configured concurrent installs!
$ bundle install
Using local cacheable path...
You must use Bundler 2 or greater with this lockfile.
由于 GitHub Pages 仅支持有限的一组 Ruby Gem (https://pages.github.com/versions/),推荐的方法是在本地构建并推送目标文件夹的内容 (./_site
默认情况下)到您的远程主机。
但是,这需要 a bit of work to set up,因为您已经设置了一个从 master
分支构建的存储库。
相对容易 的路线是完全放弃 GitHub 页面以供 Netlify, Cloudcannon 等第三方播放器使用,具体取决于您的用例.
Netlify 部署陷阱
jekyll-katex-0.3.0
至少需要 Ruby 版本 2.5.1
。因此,您必须配置 Netlify 以使用该版本。最简单的方法是定义一个环境变量 RUBY_VERSION
并将值设置为 2.5.1
- 另一个问题是 Bundler 版本。 Netlify 似乎没有使用/安装
Bundler-2.0
。所以,要么
- 使用旧版本的 Bundler 在本地生成
Gemfile.lock
,或者
- 从存储库中删除现有的
Gemfile.lock
。 (将 Gemfile.lock 添加到 .gitignore
文件将阻止它被提交回)。
- Netlify 似乎无法按预期使用
baseurl
配置。您必须将其设置为空字符串或 null
我的问题终于解决了。
我使用了另一个具有惊人主题的静态生成器 Hexo "Next",它与 KaTeX 一起工作得很好。
My site snapshot
解决问题的两个主要步骤:
第 1 步. 安装 Hexo 并将我的站点部署到 GitHub
第 2 步。嵌入 KaTex
我使用 Jekyll 3.8.5 并在 GitHub 上建立了一个博客。我还使用了 Jekyll-Katex 0.3.0,这是一个 Jekyll 插件,用于通过 KaTeX 轻松进行服务器端数学渲染。在我的本地机器上一切正常。但是当我把它推到 GitHub 时,我得到了这个:"Your site is having problems building: The tag Katexmm on line 11 in _posts/2019-01-22-ECDSA-and-Bitcoin-I.md is not a recognized Liquid tag."
"Katexmm" 是一个 liquid tag of Jekyll-Katex, so I checked dependencies. Jekyll-Katex 0.3.0 requires Jekyll ~> 3.8 while GitHub Pages uses Jekyll 3.7.4。我想这就是问题所在。
我该怎么办? 还有一件事:我想使用 "katexmm",请不要建议我使用 Jekyll 3.7.4 而不是 3.8.5。 提前致谢。
我听从了 ashmaroli 的建议,但还是不行。我尝试了 Nelify 和 "Deploy failed":
11:31:01 AM: Build ready to start
11:31:03 AM: build-image version: 84aca9ba39e0ee86ba194760fbfc51a808f62543
11:31:04 AM: buildbot version: 57d44fd1631cc3fff8b38fbaf88d3d04f946418a
11:31:04 AM: Fetching cached dependencies
11:31:04 AM: Starting to download cache of 254.7KB
11:31:04 AM: Finished downloading cache in 147.184771ms
11:31:04 AM: Starting to extract cache
11:31:04 AM: Failed to fetch cache, continuing with build
11:31:04 AM: Starting to prepare the repo for build
11:31:04 AM: No cached dependencies found. Cloning fresh repo
11:31:04 AM: git clone https://github.com/Jun-Wang-2018/Blog
11:31:05 AM: Preparing Git Reference refs/heads/gh-pages
11:31:06 AM: Starting build script
11:31:06 AM: Installing dependencies
11:31:08 AM: Downloading and installing node v8.15.0...
11:31:08 AM: Downloading https://nodejs.org/dist/v8.15.0/node-v8.15.0-linux-x64.tar.xz...
11:31:08 AM: 0.0%
11:31:08 AM:
######
11:31:08 AM: 8.4%
11:31:08 AM:
#############################################
11:31:08 AM: ### 66.8%
11:31:08 AM:
######################################
11:31:08 AM: ################################## 100.0%
11:31:08 AM: Computing checksum with sha256sum
11:31:08 AM: Checksums matched!
11:31:11 AM: Now using node v8.15.0 (npm v6.4.1)
11:31:12 AM: Attempting ruby version 2.3.6, read from environment
11:31:13 AM: Using ruby version 2.3.6
11:31:15 AM: Using PHP version 5.6
11:31:15 AM: Started restoring cached ruby gems
11:31:15 AM: Finished restoring cached ruby gems
11:31:15 AM: Installing gem bundle
11:31:15 AM: You must use Bundler 2 or greater with this lockfile.
11:31:15 AM: Error during gem install
11:31:15 AM: Error running command: Build script returned non-zero exit code: 1
11:31:15 AM: Failing build: Failed to build site
11:31:15 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:31:15 AM: Finished processing build request in 11.629358799s
我试过 Cloudcannon 和 "Jekyll build failed":
Syncing raw files... done
Checking existing local bundle state... failed
Loading gem cache...
Checking gem cache (bundle_cache/A16MrNFnrU9wWPnsPr5G8PkR_kBFEHG0ytrPjGtZ7mQ.zip)... no cache
$ export JEKYLL_ENV="production"
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
$ bundle -v
Bundler version 1.16.6
$ bundle config --global jobs 4
Configured concurrent installs!
$ bundle install
Using local cacheable path...
You must use Bundler 2 or greater with this lockfile.
由于 GitHub Pages 仅支持有限的一组 Ruby Gem (https://pages.github.com/versions/),推荐的方法是在本地构建并推送目标文件夹的内容 (./_site
默认情况下)到您的远程主机。
但是,这需要 a bit of work to set up,因为您已经设置了一个从 master
分支构建的存储库。
相对容易 的路线是完全放弃 GitHub 页面以供 Netlify, Cloudcannon 等第三方播放器使用,具体取决于您的用例.
Netlify 部署陷阱
jekyll-katex-0.3.0
至少需要 Ruby 版本2.5.1
。因此,您必须配置 Netlify 以使用该版本。最简单的方法是定义一个环境变量RUBY_VERSION
并将值设置为2.5.1
- 另一个问题是 Bundler 版本。 Netlify 似乎没有使用/安装
Bundler-2.0
。所以,要么- 使用旧版本的 Bundler 在本地生成
Gemfile.lock
,或者 - 从存储库中删除现有的
Gemfile.lock
。 (将 Gemfile.lock 添加到.gitignore
文件将阻止它被提交回)。
- 使用旧版本的 Bundler 在本地生成
- Netlify 似乎无法按预期使用
baseurl
配置。您必须将其设置为空字符串或null
我的问题终于解决了。 我使用了另一个具有惊人主题的静态生成器 Hexo "Next",它与 KaTeX 一起工作得很好。
My site snapshot
解决问题的两个主要步骤:
第 1 步. 安装 Hexo 并将我的站点部署到 GitHub
第 2 步。嵌入 KaTex