Jekyll 漂亮的长相人不';无法使用GitHub页面
Pretty permalinks在本地工作,但不部署到GitHub页面。对可能的原因感到困惑。仍然可以通过Jekyll 漂亮的长相人不';无法使用GitHub页面,jekyll,permalinks,github-pages,Jekyll,Permalinks,Github Pages,Pretty permalinks在本地工作,但不部署到GitHub页面。对可能的原因感到困惑。仍然可以通过.html访问页面 _config.yml title: Project Name baseurl: /project-name url: "http://organization-name.github.io" google_analytics: # set tracking gems: - jekyll-redirect-from exclude: - Gemfile -
.html
访问页面
_config.yml
title: Project Name
baseurl: /project-name
url: "http://organization-name.github.io"
google_analytics: # set tracking
gems:
- jekyll-redirect-from
exclude:
- Gemfile
- Gemfile.lock
permalinks: pretty
markdown: kramdown
defaults:
-
scope:
path: ""
type: "pages"
values:
permalink: "/:basename/"
Gemfile
source "https://rubygems.org"
ruby RUBY_VERSION
gem "github-pages", group: :jekyll_plugins
group :jekyll_plugins do
end
因此,我通过将permalink显式添加到page meta解决了这个问题。例如
permalink: /about/
奇怪的是,本地不需要它。您必须修改您的_config.yml
title: Project Name
baseurl: /project-name
url: "http://organization-name.github.io"
google_analytics: # set tracking
gems:
- jekyll-redirect-from
exclude:
- Gemfile
- Gemfile.lock
permalinks: pretty
markdown: kramdown
defaults:
-
scope:
path: ""
type: "pages"
values:
permalink: "/:basename/"
您可能需要调整此示例
例如,如果要将文件夹结构保留在永久链接中,可以:
defaults:
-
scope:
path: ""
type: "pages"
values:
permalink: "/:path/:basename/"
注意:“pretty”是“/:path/:basename/”正确的语法是
permalink:pretty
:singular。您的本地Jekyll安装使用不同的web服务器以不同但类似的路由配置访问GitHub页面,这将解释处理URL的差异。